Package org.conscrypt
Interface NativeCrypto.SSLHandshakeCallbacks
-
- All Known Implementing Classes:
OpenSSLEngineImpl,OpenSSLSocketImpl,OpenSSLSocketImplWrapper
- Enclosing class:
- NativeCrypto
public static interface NativeCrypto.SSLHandshakeCallbacksA collection of callbacks from the native OpenSSL code that are related to the SSL handshake initiated by SSL_do_handshake.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclientCertificateRequested(byte[] keyTypes, byte[][] asn1DerEncodedX500Principals)Called on an SSL client when the server requests (or requires a certificate).intclientPSKKeyRequested(String identityHint, byte[] identity, byte[] key)Gets the key to be used in client mode for this connection in Pre-Shared Key (PSK) key exchange.voidonSSLStateChange(long sslSessionNativePtr, int type, int val)Called when SSL state changes.intserverPSKKeyRequested(String identityHint, String identity, byte[] key)Gets the key to be used in server mode for this connection in Pre-Shared Key (PSK) key exchange.voidverifyCertificateChain(long sslSessionNativePtr, long[] certificateChainRefs, String authMethod)Verify that we trust the certificate chain is trusted.
-
-
-
Method Detail
-
verifyCertificateChain
void verifyCertificateChain(long sslSessionNativePtr, long[] certificateChainRefs, String authMethod) throws CertificateExceptionVerify that we trust the certificate chain is trusted.- Parameters:
sslSessionNativePtr- pointer to a reference of the SSL_SESSIONcertificateChainRefs- chain of X.509 certificate referencesauthMethod- auth algorithm name- Throws:
CertificateException- if the certificate is untrusted
-
clientCertificateRequested
void clientCertificateRequested(byte[] keyTypes, byte[][] asn1DerEncodedX500Principals) throws CertificateEncodingException, SSLExceptionCalled on an SSL client when the server requests (or requires a certificate). The client can respond by using SSL_use_certificate and SSL_use_PrivateKey to set a certificate if has an appropriate one available, similar to how the server provides its certificate.- Parameters:
keyTypes- key types supported by the server, convertible to strings with #keyTypeasn1DerEncodedX500Principals- CAs known to the server- Throws:
CertificateEncodingExceptionSSLException
-
clientPSKKeyRequested
int clientPSKKeyRequested(String identityHint, byte[] identity, byte[] key)
Gets the key to be used in client mode for this connection in Pre-Shared Key (PSK) key exchange.- Parameters:
identityHint- PSK identity hint provided by the server ornullif no hint provided.identity- buffer to be populated with PSK identity (NULL-terminated modified UTF-8) by this method. This identity will be provided to the server.key- buffer to be populated with key material by this method.- Returns:
- number of bytes this method stored in the
keybuffer or0if an error occurred in which case the handshake will be aborted.
-
serverPSKKeyRequested
int serverPSKKeyRequested(String identityHint, String identity, byte[] key)
Gets the key to be used in server mode for this connection in Pre-Shared Key (PSK) key exchange.- Parameters:
identityHint- PSK identity hint provided by this server to the client ornullif no hint was provided.identity- PSK identity provided by the client.key- buffer to be populated with key material by this method.- Returns:
- number of bytes this method stored in the
keybuffer or0if an error occurred in which case the handshake will be aborted.
-
onSSLStateChange
void onSSLStateChange(long sslSessionNativePtr, int type, int val)Called when SSL state changes. This could be handshake completion.
-
-