ne_ssl.h | ne_ssl.h | |||
---|---|---|---|---|
/* | /* | |||
SSL/TLS abstraction layer for neon | SSL/TLS abstraction layer for neon | |||
Copyright (C) 2003-2006, Joe Orton <joe@manyfish.co.uk> | Copyright (C) 2003-2006, 2009, Joe Orton <joe@manyfish.co.uk> | |||
This library is free software; you can redistribute it and/or | This library is free software; you can redistribute it and/or | |||
modify it under the terms of the GNU Library General Public | modify it under the terms of the GNU Library General Public | |||
License as published by the Free Software Foundation; either | License as published by the Free Software Foundation; either | |||
version 2 of the License, or (at your option) any later version. | version 2 of the License, or (at your option) any later version. | |||
This library is distributed in the hope that it will be useful, | This library is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
Library General Public License for more details. | Library General Public License for more details. | |||
skipping to change at line 119 | skipping to change at line 119 | |||
char *from, char *until); | char *from, char *until); | |||
/* Returns zero if 'c1' and 'c2' refer to the same certificate, or | /* Returns zero if 'c1' and 'c2' refer to the same certificate, or | |||
* non-zero otherwise. */ | * non-zero otherwise. */ | |||
int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, | int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, | |||
const ne_ssl_certificate *c2); | const ne_ssl_certificate *c2); | |||
/* Deallocate memory associated with certificate. */ | /* Deallocate memory associated with certificate. */ | |||
void ne_ssl_cert_free(ne_ssl_certificate *cert); | void ne_ssl_cert_free(ne_ssl_certificate *cert); | |||
/* A client certificate (and private key). */ | /* A client certificate (and private key). A client certificate | |||
* object has state; the object is either in the "encrypted" or | ||||
* "decrypted" state. */ | ||||
typedef struct ne_ssl_client_cert_s ne_ssl_client_cert; | typedef struct ne_ssl_client_cert_s ne_ssl_client_cert; | |||
/* Read a client certificate and private key from a PKCS12 file; | /* Read a client certificate and private key from a PKCS12 file; | |||
* returns NULL if the file could not be parsed, or otherwise | * returns NULL if the file could not be parsed, or otherwise | |||
* returning a client certificate object. */ | * returning a client certificate object. The returned object may be | |||
* in either the encrypted or decrypted state. */ | ||||
ne_ssl_client_cert *ne_ssl_clicert_read(const char *filename); | ne_ssl_client_cert *ne_ssl_clicert_read(const char *filename); | |||
/* Returns non-zero if client cert is in the encrypted state. */ | ||||
int ne_ssl_clicert_encrypted(const ne_ssl_client_cert *ccert); | ||||
/* Returns the "friendly name" given for the client cert, or NULL if | /* Returns the "friendly name" given for the client cert, or NULL if | |||
* none given. This can be called before or after the client cert has | * none given. Returns a NUL-terminated, UTF-8-encoded string. This | |||
* been decrypted. Returns a NUL-terminated, UTF-8-encoded string. */ | * function may be used on a ccert object in either encrypted or | |||
* decrypted state. */ | ||||
const char *ne_ssl_clicert_name(const ne_ssl_client_cert *ccert); | const char *ne_ssl_clicert_name(const ne_ssl_client_cert *ccert); | |||
/* Returns non-zero if client cert is encrypted. */ | /* Decrypt the encrypted client cert using the given password. | |||
int ne_ssl_clicert_encrypted(const ne_ssl_client_cert *ccert); | * Returns non-zero on failure, in which case, the ccert object | |||
* remains in the encrypted state and the function may be called again | ||||
/* Decrypt the encrypted client cert using given password. Returns | * with a different password. This function has undefined behaviour | |||
* non-zero on failure, in which case, the function can be called | * for a ccert object which is in the decrypted state. */ | |||
* again with a different password. For a ccert on which _encrypted() | ||||
* returns 0, calling _decrypt results in undefined behaviour. */ | ||||
int ne_ssl_clicert_decrypt(ne_ssl_client_cert *ccert, const char *password) ; | int ne_ssl_clicert_decrypt(ne_ssl_client_cert *ccert, const char *password) ; | |||
/* Return the actual certificate part of the client certificate (never | /* Return the actual certificate part of the client certificate (never | |||
* returns NULL). */ | * returns NULL). This function has undefined behaviour for a ccert | |||
* object which is in the encrypted state. */ | ||||
const ne_ssl_certificate *ne_ssl_clicert_owner(const ne_ssl_client_cert *cc ert); | const ne_ssl_certificate *ne_ssl_clicert_owner(const ne_ssl_client_cert *cc ert); | |||
/* Destroy a client certificate object. */ | /* Destroy a client certificate object. This function may be used on | |||
* a ccert object in either the encrypted or decrypted state. */ | ||||
void ne_ssl_clicert_free(ne_ssl_client_cert *ccert); | void ne_ssl_clicert_free(ne_ssl_client_cert *ccert); | |||
/* SSL context object. The interfaces to manipulate an SSL context | /* SSL context object. The interfaces to manipulate an SSL context | |||
* are only needed when interfacing directly with ne_socket.h. */ | * are only needed when interfacing directly with ne_socket.h. */ | |||
typedef struct ne_ssl_context_s ne_ssl_context; | typedef struct ne_ssl_context_s ne_ssl_context; | |||
/* Context creation modes: */ | /* Context creation modes: */ | |||
#define NE_SSL_CTX_CLIENT (0) /* client context */ | #define NE_SSL_CTX_CLIENT (0) /* client context */ | |||
#define NE_SSL_CTX_SERVER (1) /* default server context */ | #define NE_SSL_CTX_SERVER (1) /* default server context */ | |||
#define NE_SSL_CTX_SERVERv2 (2) /* SSLv2-specific server context */ | #define NE_SSL_CTX_SERVERv2 (2) /* SSLv2-specific server context */ | |||
End of changes. 8 change blocks. | ||||
14 lines changed or deleted | 21 lines changed or added | |||