1 /* tls-macos.h 2 * 3 * Copyright (c) 2020-2021 Apple Inc. All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * https://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 * Definitions for getting TLS certificate and setting TLS. 18 */ 19 20 #ifndef __DNSSD_PROXY_TLS_APPLE_H__ 21 #define __DNSSD_PROXY_TLS_APPLE_H__ 22 23 #include <stdio.h> 24 #include <Security/SecKey.h> 25 #include <Network/Network.h> 26 #include <CoreUtils/CoreUtils.h> // For OSStatus. 27 28 //====================================================================================================================== 29 // MARK: - Structures 30 31 typedef struct tls_config_context tls_config_context_t; 32 struct tls_config_context { 33 nw_protocol_options_t tls_options; 34 dispatch_queue_t queue; 35 }; 36 37 //====================================================================================================================== 38 // MARK: - Function Declarations 39 40 /*! 41 * @brief 42 * Get identity (the combination of private key and certificate) from keychain, or generate a new one if there is no existing identity in keychain. 43 * 44 * @result 45 * Returns true if identity is fetched successfully. 46 * 47 * @discussion 48 * The certificate being generated is a self-signed one, which means there will be no CA to veriry this trustworthiness of certificate. 49 */ 50 bool 51 srp_tls_init(void); 52 53 #endif /* #ifndef __DNSSD_PROXY_TLS_APPLE_H__ */ 54