proton/ssl.h

Go to the documentation of this file.
00001 #ifndef PROTON_SSL_H
00002 #define PROTON_SSL_H 1
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include <proton/import_export.h>
00026 #include <proton/type_compat.h>
00027 #include <proton/types.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00080 typedef struct pn_ssl_domain_t pn_ssl_domain_t;
00081 
00085 typedef struct pn_ssl_t pn_ssl_t;
00086 
00090 typedef enum {
00091   PN_SSL_MODE_CLIENT = 1, 
00092   PN_SSL_MODE_SERVER      
00093 } pn_ssl_mode_t;
00094 
00098 typedef enum {
00099   PN_SSL_RESUME_UNKNOWN,        
00100   PN_SSL_RESUME_NEW,            
00101   PN_SSL_RESUME_REUSED          
00102 } pn_ssl_resume_status_t;
00103 
00109 PN_EXTERN bool pn_ssl_present( void );
00110 
00122 PN_EXTERN pn_ssl_domain_t *pn_ssl_domain(pn_ssl_mode_t mode);
00123 
00130 PN_EXTERN void pn_ssl_domain_free(pn_ssl_domain_t *domain);
00131 
00156 PN_EXTERN int  pn_ssl_domain_set_credentials(pn_ssl_domain_t *domain,
00157                                             const char *credential_1,
00158                                             const char *credential_2,
00159                                             const char *password);
00160 
00181 PN_EXTERN int pn_ssl_domain_set_trusted_ca_db(pn_ssl_domain_t *domain,
00182                                 const char *certificate_db);
00183 
00200 typedef enum {
00201   PN_SSL_VERIFY_NULL = 0,   
00202   PN_SSL_VERIFY_PEER,       
00203   PN_SSL_ANONYMOUS_PEER,    
00204   PN_SSL_VERIFY_PEER_NAME   
00205 } pn_ssl_verify_mode_t;
00206 
00230 PN_EXTERN int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
00231                                                     const pn_ssl_verify_mode_t mode,
00232                                                     const char *trusted_CAs);
00233 
00247 PN_EXTERN int pn_ssl_domain_set_protocols(pn_ssl_domain_t *domain, const char *protocols);
00248 
00259 PN_EXTERN int pn_ssl_domain_set_ciphers(pn_ssl_domain_t *domain, const char *ciphers);
00260 
00273 PN_EXTERN int pn_ssl_domain_allow_unsecured_client(pn_ssl_domain_t *domain);
00274 
00285 PN_EXTERN pn_ssl_t *pn_ssl(pn_transport_t *transport);
00286 
00311 PN_EXTERN int pn_ssl_init(pn_ssl_t *ssl,
00312                           pn_ssl_domain_t *domain,
00313                           const char *session_id);
00314 
00328 PN_EXTERN bool pn_ssl_get_cipher_name(pn_ssl_t *ssl, char *buffer, size_t size);
00329 
00336 PN_EXTERN int pn_ssl_get_ssf(pn_ssl_t *ssl);
00337 
00350 PN_EXTERN bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *buffer, size_t size);
00351 
00365 PN_EXTERN pn_ssl_resume_status_t pn_ssl_resume_status(pn_ssl_t *ssl);
00366 
00389 PN_EXTERN int pn_ssl_set_peer_hostname(pn_ssl_t *ssl, const char *hostname);
00390 
00404 PN_EXTERN int pn_ssl_get_peer_hostname(pn_ssl_t *ssl, char *hostname, size_t *bufsize);
00405 
00413 PN_EXTERN const char* pn_ssl_get_remote_subject(pn_ssl_t *ssl);
00414 
00418 typedef enum {
00419   PN_SSL_CERT_SUBJECT_COUNTRY_NAME,
00420   PN_SSL_CERT_SUBJECT_STATE_OR_PROVINCE,
00421   PN_SSL_CERT_SUBJECT_CITY_OR_LOCALITY,
00422   PN_SSL_CERT_SUBJECT_ORGANIZATION_NAME,
00423   PN_SSL_CERT_SUBJECT_ORGANIZATION_UNIT,
00424   PN_SSL_CERT_SUBJECT_COMMON_NAME
00425 } pn_ssl_cert_subject_subfield;
00426 
00430 typedef enum {
00431   PN_SSL_SHA1,   /* Produces hash that is 20 bytes long */
00432   PN_SSL_SHA256, /* Produces hash that is 32 bytes long */
00433   PN_SSL_SHA512, /* Produces hash that is 64 bytes long */
00434   PN_SSL_MD5     /* Produces hash that is 16 bytes long */
00435 } pn_ssl_hash_alg;
00436 
00450 PN_EXTERN int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0,
00451                                           char *fingerprint,
00452                                           size_t fingerprint_length,
00453                                           pn_ssl_hash_alg hash_alg);
00454 
00467 PN_EXTERN const char* pn_ssl_get_remote_subject_subfield(pn_ssl_t *ssl0, pn_ssl_cert_subject_subfield field);
00468 
00473 #ifdef __cplusplus
00474 }
00475 #endif
00476 
00477 #endif /* ssl.h */

Generated on 8 Oct 2019 for Qpid Proton C by  doxygen 1.6.1