25 #include <proton/import_export.h>
100 #define PN_TLS_OK (0)
101 #define PN_TLS_INIT_ERR (-1)
102 #define PN_TLS_PROTOCOL_ERR (-2)
103 #define PN_TLS_AUTHENTICATION_ERR (-3)
104 #define PN_TLS_STATE_ERR (-4)
153 const char *credential_1,
154 const char *credential_2,
155 const char *password);
178 const char *certificate_db);
229 const char *trusted_CAs);
264 PN_TLS_EXTERN
void pn_tls_free(
pn_tls_t *tls);
355 PN_TLS_CERT_SUBJECT_COUNTRY_NAME,
356 PN_TLS_CERT_SUBJECT_STATE_OR_PROVINCE,
357 PN_TLS_CERT_SUBJECT_CITY_OR_LOCALITY,
358 PN_TLS_CERT_SUBJECT_ORGANIZATION_NAME,
359 PN_TLS_CERT_SUBJECT_ORGANIZATION_UNIT,
360 PN_TLS_CERT_SUBJECT_COMMON_NAME
388 size_t fingerprint_length,
405 PN_TLS_EXTERN
bool pn_tls_is_encrypt_output_pending(
pn_tls_t *tls);
406 PN_TLS_EXTERN
bool pn_tls_is_decrypt_output_pending(
pn_tls_t *tls);
410 PN_TLS_EXTERN
bool pn_tls_is_secure(
pn_tls_t *tls);
434 PN_TLS_EXTERN
size_t pn_tls_give_encrypt_input_buffers(
pn_tls_t*,
pn_raw_buffer_t const* bufs,
size_t count_bufs);
437 PN_TLS_EXTERN
size_t pn_tls_give_decrypt_input_buffers(
pn_tls_t*,
pn_raw_buffer_t const* bufs,
size_t count_bufs);
446 PN_TLS_EXTERN
size_t pn_tls_get_encrypt_input_buffer_capacity(
pn_tls_t*);
447 PN_TLS_EXTERN
size_t pn_tls_get_decrypt_input_buffer_capacity(
pn_tls_t*);
452 PN_TLS_EXTERN
bool pn_tls_need_encrypt_output_buffers(
pn_tls_t*);
453 PN_TLS_EXTERN
bool pn_tls_need_decrypt_output_buffers(
pn_tls_t*);
455 PN_TLS_EXTERN
size_t pn_tls_get_encrypt_output_buffer_capacity(
pn_tls_t*);
456 PN_TLS_EXTERN
size_t pn_tls_get_decrypt_output_buffer_capacity(
pn_tls_t*);
459 PN_TLS_EXTERN
size_t pn_tls_get_decrypt_output_buffer_count(
pn_tls_t*);
460 PN_TLS_EXTERN
size_t pn_tls_get_encrypt_output_buffer_count(
pn_tls_t*);
462 PN_TLS_EXTERN uint32_t pn_tls_get_last_decrypt_output_buffer_size(
pn_tls_t*);
463 PN_TLS_EXTERN uint32_t pn_tls_get_last_encrypt_output_buffer_size(
pn_tls_t*);
467 PN_TLS_EXTERN
void pn_tls_set_encrypt_input_buffer_max_capacity(
pn_tls_t*,
size_t s);
468 PN_TLS_EXTERN
void pn_tls_set_decrypt_input_buffer_max_capacity(
pn_tls_t*,
size_t s);
469 PN_TLS_EXTERN
void pn_tls_set_encrypt_output_buffer_max_capacity(
pn_tls_t*,
size_t s);
470 PN_TLS_EXTERN
void pn_tls_set_decrypt_output_buffer_max_capacity(
pn_tls_t*,
size_t s);
476 PN_TLS_EXTERN
int pn_tls_process(
pn_tls_t* tls);
482 PN_TLS_EXTERN
int pn_tls_stop(
pn_tls_t* tls);
486 PN_TLS_EXTERN
bool pn_tls_is_input_closed(
pn_tls_t* tls);
490 PN_TLS_EXTERN
void pn_tls_close_output(
pn_tls_t* tls);
499 PN_TLS_EXTERN
int pn_tls_get_session_error(
pn_tls_t* tls);
502 PN_TLS_EXTERN
size_t pn_tls_get_session_error_string(
pn_tls_t* tls,
char *buf,
size_t buf_len);
A descriptor used to represent a single raw buffer in memory.
Definition: raw_connection.h:54
PN_TLS_EXTERN bool pn_tls_get_alpn_protocol(pn_tls_t *tls, const char **protocol_name, size_t *size)
Get the name of the negotiated application protocol.
PN_TLS_EXTERN bool pn_tls_get_cipher(pn_tls_t *tls, const char **cipher, size_t *size)
Get the name of the Cipher that is currently in use.
PN_TLS_EXTERN const char * pn_tls_get_remote_subject_subfield(pn_tls_t *tls, pn_tls_cert_subject_subfield field)
Returns a char pointer that contains the value of the sub field of the subject field in the tls certi...
PN_TLS_EXTERN int pn_tls_get_peer_hostname(pn_tls_t *tls, char *hostname, size_t *bufsize)
Access the configured peer identity.
PN_TLS_EXTERN int pn_tls_start(pn_tls_t *tls)
Start a TLS session.
PN_TLS_EXTERN void pn_tls_config_free(pn_tls_config_t *domain)
Release an TLS configuration domain.
PN_TLS_EXTERN int pn_tls_get_cert_fingerprint(pn_tls_t *tls0, char *fingerprint, size_t fingerprint_length, pn_tls_hash_alg hash_alg)
Get the fingerprint of the certificate.
pn_tls_hash_alg
Enumeration identifying hashing algorithm.
Definition: tls.h:366
PN_TLS_EXTERN int pn_tls_set_peer_hostname(pn_tls_t *tls, const char *hostname)
Set the expected identity of the remote peer.
PN_TLS_EXTERN int pn_tls_config_set_trusted_certs(pn_tls_config_t *domain, const char *certificate_db)
Configure the set of trusted CA certificates used by this domain to verify peers.
struct pn_tls_t pn_tls_t
Definition: tls.h:86
pn_tls_mode_t
Determines the type of TLS endpoint.
Definition: tls.h:91
pn_tls_verify_mode_t
Determines the level of peer validation.
Definition: tls.h:196
PN_TLS_EXTERN const char * pn_tls_get_remote_subject(pn_tls_t *tls)
Get the subject from the peers certificate.
PN_TLS_EXTERN int pn_tls_config_set_peer_authentication(pn_tls_config_t *domain, const pn_tls_verify_mode_t mode, const char *trusted_CAs)
Configure the level of verification used on the peer certificate.
PN_TLS_EXTERN bool pn_tls_get_protocol_version(pn_tls_t *tls, const char **version, size_t *size)
Get the name of the TLS protocol that is currently in use.
PN_TLS_EXTERN int pn_tls_config_set_credentials(pn_tls_config_t *domain, const char *credential_1, const char *credential_2, const char *password)
Set the certificate that identifies the local node to the remote.
PN_TLS_EXTERN int pn_tls_config_set_impl_ciphers(pn_tls_config_t *domain, const char *ciphers)
Configure the list of permitted ciphers.
PN_TLS_EXTERN pn_tls_t * pn_tls(pn_tls_config_t *domain)
Create a new TLS session object derived from a domain.
pn_tls_cert_subject_subfield
Enumeration identifying the sub fields of the subject field in the tls certificate.
Definition: tls.h:354
struct pn_tls_config_t pn_tls_config_t
API for using TLS separate from AMQP connections.
Definition: tls.h:81
PN_TLS_EXTERN int pn_tls_get_ssf(pn_tls_t *tls)
Get the SSF (security strength factor) of the Cipher that is currently in use.
PN_TLS_EXTERN int pn_tls_config_set_alpn_protocols(pn_tls_config_t *domain, const char **protocols, size_t protocol_count)
Provide an ordered list of application protols for RFC 7301 negotiation.
PN_TLS_EXTERN pn_tls_config_t * pn_tls_config(pn_tls_mode_t mode)
Create an TLS configuration domain.
@ PN_TLS_MODE_SERVER
Local connection endpoint is an TLS server.
Definition: tls.h:93
@ PN_TLS_MODE_CLIENT
Local connection endpoint is an TLS client.
Definition: tls.h:92
@ PN_TLS_VERIFY_NULL
internal use only
Definition: tls.h:197
@ PN_TLS_VERIFY_PEER_NAME
require valid certificate and matching name
Definition: tls.h:200
@ PN_TLS_VERIFY_PEER
require peer to provide a valid identifying certificate
Definition: tls.h:198
@ PN_TLS_ANONYMOUS_PEER
do not require a certificate nor cipher authorization
Definition: tls.h:199