OLD | NEW |
1 /* | 1 /* |
2 * This file contains prototypes for the public SSL functions. | 2 * This file contains prototypes for the public SSL functions. |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 | 7 |
8 #ifndef __ssl_h_ | 8 #ifndef __ssl_h_ |
9 #define __ssl_h_ | 9 #define __ssl_h_ |
10 | 10 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 /* | 428 /* |
429 ** Return the certificate for our SSL peer. If the client calls this | 429 ** Return the certificate for our SSL peer. If the client calls this |
430 ** it will always return the server's certificate. If the server calls | 430 ** it will always return the server's certificate. If the server calls |
431 ** this, it may return NULL if client authentication is not enabled or | 431 ** this, it may return NULL if client authentication is not enabled or |
432 ** if the client had no certificate when asked. | 432 ** if the client had no certificate when asked. |
433 ** "fd" the socket "file" descriptor | 433 ** "fd" the socket "file" descriptor |
434 */ | 434 */ |
435 SSL_IMPORT CERTCertificate *SSL_PeerCertificate(PRFileDesc *fd); | 435 SSL_IMPORT CERTCertificate *SSL_PeerCertificate(PRFileDesc *fd); |
436 | 436 |
| 437 /* |
| 438 ** Return the certificates presented by the SSL peer. If the SSL peer |
| 439 ** did not present certificates, return NULL with the |
| 440 ** SSL_ERROR_NO_CERTIFICATE error. On failure, return NULL with an error |
| 441 ** code other than SSL_ERROR_NO_CERTIFICATE. |
| 442 ** "fd" the socket "file" descriptor |
| 443 */ |
| 444 SSL_IMPORT CERTCertList *SSL_PeerCertificateChain(PRFileDesc *fd); |
| 445 |
437 /* SSL_PeerStapledOCSPResponses returns the OCSP responses that were provided | 446 /* SSL_PeerStapledOCSPResponses returns the OCSP responses that were provided |
438 * by the TLS server. The return value is a pointer to an internal SECItemArray | 447 * by the TLS server. The return value is a pointer to an internal SECItemArray |
439 * that contains the returned OCSP responses; it is only valid until the | 448 * that contains the returned OCSP responses; it is only valid until the |
440 * callback function that calls SSL_PeerStapledOCSPResponses returns. | 449 * callback function that calls SSL_PeerStapledOCSPResponses returns. |
441 * | 450 * |
442 * If no OCSP responses were given by the server then the result will be empty. | 451 * If no OCSP responses were given by the server then the result will be empty. |
443 * If there was an error, then the result will be NULL. | 452 * If there was an error, then the result will be NULL. |
444 * | 453 * |
445 * You must set the SSL_ENABLE_OCSP_STAPLING option to enable OCSP stapling. | 454 * You must set the SSL_ENABLE_OCSP_STAPLING option to enable OCSP stapling. |
446 * to be provided by a server. | 455 * to be provided by a server. |
447 * | 456 * |
448 * libssl does not do any validation of the OCSP response itself; the | 457 * libssl does not do any validation of the OCSP response itself; the |
449 * authenticate certificate hook is responsible for doing so. The default | 458 * authenticate certificate hook is responsible for doing so. The default |
450 * authenticate certificate hook, SSL_AuthCertificate, does not implement | 459 * authenticate certificate hook, SSL_AuthCertificate, does not implement |
451 * any OCSP stapling funtionality, but this may change in future versions. | 460 * any OCSP stapling funtionality, but this may change in future versions. |
452 */ | 461 */ |
453 SSL_IMPORT const SECItemArray * SSL_PeerStapledOCSPResponses(PRFileDesc *fd); | 462 SSL_IMPORT const SECItemArray * SSL_PeerStapledOCSPResponses(PRFileDesc *fd); |
454 | 463 |
455 /* SSL_SetStapledOCSPResponses stores an array of one or multiple OCSP responses | 464 /* SSL_SetStapledOCSPResponses stores an array of one or multiple OCSP responses |
456 * in the fd's data, which may be sent as part of a server side cert_status | 465 * in the fd's data, which may be sent as part of a server side cert_status |
457 * handshake message. Parameter |responses| is for the server certificate of | 466 * handshake message. Parameter |responses| is for the server certificate of |
458 * the key exchange type |kea|. | 467 * the key exchange type |kea|. |
459 * The function will duplicate the responses array. | 468 * The function will duplicate the responses array. |
460 */ | 469 */ |
461 SSL_IMPORT SECStatus | 470 SSL_IMPORT SECStatus |
462 SSL_SetStapledOCSPResponses(PRFileDesc *fd, const SECItemArray *responses, | 471 SSL_SetStapledOCSPResponses(PRFileDesc *fd, const SECItemArray *responses, |
463 SSLKEAType kea); | 472 SSLKEAType kea); |
464 | 473 |
465 /* | 474 /* |
466 ** Return references to the certificates presented by the SSL peer. | |
467 ** |maxNumCerts| must contain the size of the |certs| array. On successful | |
468 ** return, |*numCerts| contains the number of certificates available and | |
469 ** |certs| will contain references to as many certificates as would fit. | |
470 ** Therefore if |*numCerts| contains a value less than or equal to | |
471 ** |maxNumCerts|, then all certificates were returned. | |
472 */ | |
473 SSL_IMPORT SECStatus SSL_PeerCertificateChain( | |
474 PRFileDesc *fd, CERTCertificate **certs, | |
475 unsigned int *numCerts, unsigned int maxNumCerts); | |
476 | |
477 /* | |
478 ** Authenticate certificate hook. Called when a certificate comes in | 475 ** Authenticate certificate hook. Called when a certificate comes in |
479 ** (because of SSL_REQUIRE_CERTIFICATE in SSL_Enable) to authenticate the | 476 ** (because of SSL_REQUIRE_CERTIFICATE in SSL_Enable) to authenticate the |
480 ** certificate. | 477 ** certificate. |
481 ** | 478 ** |
482 ** The authenticate certificate hook must return SECSuccess to indicate the | 479 ** The authenticate certificate hook must return SECSuccess to indicate the |
483 ** certificate is valid, SECFailure to indicate the certificate is invalid, | 480 ** certificate is valid, SECFailure to indicate the certificate is invalid, |
484 ** or SECWouldBlock if the application will authenticate the certificate | 481 ** or SECWouldBlock if the application will authenticate the certificate |
485 ** asynchronously. SECWouldBlock is only supported for non-blocking sockets. | 482 ** asynchronously. SECWouldBlock is only supported for non-blocking sockets. |
486 ** | 483 ** |
487 ** If the authenticate certificate hook returns SECFailure, then the bad cert | 484 ** If the authenticate certificate hook returns SECFailure, then the bad cert |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 * should continue using the connection. If the application passes a non-zero | 1098 * should continue using the connection. If the application passes a non-zero |
1102 * value for second argument (error), or if SSL_AuthCertificateComplete returns | 1099 * value for second argument (error), or if SSL_AuthCertificateComplete returns |
1103 * anything other than SECSuccess, then the application should close the | 1100 * anything other than SECSuccess, then the application should close the |
1104 * connection. | 1101 * connection. |
1105 */ | 1102 */ |
1106 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd, | 1103 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd, |
1107 PRErrorCode error); | 1104 PRErrorCode error); |
1108 SEC_END_PROTOS | 1105 SEC_END_PROTOS |
1109 | 1106 |
1110 #endif /* __ssl_h_ */ | 1107 #endif /* __ssl_h_ */ |
OLD | NEW |