Package org.conscrypt
Class NativeSsl
- java.lang.Object
-
- org.conscrypt.NativeSsl
-
final class NativeSsl extends java.lang.ObjectA utility wrapper that abstracts operations on the underlying native SSL instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classNativeSsl.BioWrapperA utility wrapper that abstracts operations on the underlying native BIO instance.
-
Field Summary
Fields Modifier and Type Field Description private SSLParametersImpl.AliasChooseraliasChooserprivate NativeCrypto.SSLHandshakeCallbackshandshakeCallbacksprivate java.security.cert.X509Certificate[]localCertificatesprivate java.util.concurrent.locks.ReadWriteLocklockprivate SSLParametersImplparametersprivate SSLParametersImpl.PSKCallbackspskCallbacksprivate longssl
-
Constructor Summary
Constructors Modifier Constructor Description privateNativeSsl(long ssl, SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser aliasChooser, SSLParametersImpl.PSKCallbacks pskCallbacks)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidchooseClientCertificate(byte[] keyTypeBytes, int[] signatureAlgs, byte[][] asn1DerEncodedPrincipals)(package private) intclientPSKKeyRequested(java.lang.String identityHint, byte[] identityBytesOut, byte[] key)(package private) voidclose()(package private) voidconfigureServerCertificate()(package private) intdoHandshake()(package private) voiddoHandshake(java.io.FileDescriptor fd, int timeoutMillis)private voidenablePSKKeyManagerIfRequested()(package private) byte[]exportKeyingMaterial(java.lang.String label, byte[] context, int length)protected voidfinalize()(package private) voidforceRead()(package private) byte[]getApplicationProtocol()private java.util.Set<java.lang.String>getCipherKeyTypes()(package private) java.lang.StringgetCipherSuite()(package private) intgetError(int result)(package private) java.security.cert.X509Certificate[]getLocalCertificates()(package private) intgetMaxSealOverhead()(package private) byte[]getPeerCertificateOcspData()(package private) java.security.cert.X509Certificate[]getPeerCertificates()(package private) byte[]getPeerTlsSctData()(package private) intgetPendingReadableBytes()(package private) java.lang.StringgetRequestedServerName()(package private) byte[]getSessionId()(package private) longgetTime()(package private) longgetTimeout()(package private) byte[]getTlsChannelId()(package private) byte[]getTlsUnique()(package private) java.lang.StringgetVersion()(package private) voidinitialize(java.lang.String hostname, OpenSSLKey channelIdPrivateKey)(package private) voidinterrupt()private booleanisClient()(package private) booleanisClosed()(package private) NativeSsl.BioWrappernewBio()(package private) static NativeSslnewInstance(SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser chooser, SSLParametersImpl.PSKCallbacks pskCallbacks)(package private) voidofferToResumeSession(long sslSessionNativePointer)(package private) intread(java.io.FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis)(package private) intreadDirectByteBuffer(long destAddress, int destLength)(package private) intserverPSKKeyRequested(java.lang.String identityHint, java.lang.String identity, byte[] key)private voidsetCertificate(java.lang.String alias)private voidsetCertificateValidation()(package private) voidsetTimeout(long millis)private voidsetTlsChannelId(OpenSSLKey channelIdPrivateKey)(package private) voidshutdown()(package private) voidshutdown(java.io.FileDescriptor fd)private voidverifyWithSniMatchers(java.lang.String serverName)(package private) booleanwasShutdownReceived()(package private) booleanwasShutdownSent()(package private) voidwrite(java.io.FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis)(package private) intwriteDirectByteBuffer(long sourceAddress, int sourceLength)
-
-
-
Field Detail
-
parameters
private final SSLParametersImpl parameters
-
handshakeCallbacks
private final NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks
-
aliasChooser
private final SSLParametersImpl.AliasChooser aliasChooser
-
pskCallbacks
private final SSLParametersImpl.PSKCallbacks pskCallbacks
-
localCertificates
private java.security.cert.X509Certificate[] localCertificates
-
lock
private final java.util.concurrent.locks.ReadWriteLock lock
-
ssl
private volatile long ssl
-
-
Constructor Detail
-
NativeSsl
private NativeSsl(long ssl, SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser aliasChooser, SSLParametersImpl.PSKCallbacks pskCallbacks)
-
-
Method Detail
-
newInstance
static NativeSsl newInstance(SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser chooser, SSLParametersImpl.PSKCallbacks pskCallbacks) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
newBio
NativeSsl.BioWrapper newBio()
-
offerToResumeSession
void offerToResumeSession(long sslSessionNativePointer) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
getSessionId
byte[] getSessionId()
-
getTime
long getTime()
-
getTimeout
long getTimeout()
-
setTimeout
void setTimeout(long millis)
-
getCipherSuite
java.lang.String getCipherSuite()
-
getPeerCertificates
java.security.cert.X509Certificate[] getPeerCertificates() throws java.security.cert.CertificateException- Throws:
java.security.cert.CertificateException
-
getLocalCertificates
java.security.cert.X509Certificate[] getLocalCertificates()
-
getPeerCertificateOcspData
byte[] getPeerCertificateOcspData()
-
getTlsUnique
byte[] getTlsUnique()
-
exportKeyingMaterial
byte[] exportKeyingMaterial(java.lang.String label, byte[] context, int length) throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
getPeerTlsSctData
byte[] getPeerTlsSctData()
-
clientPSKKeyRequested
int clientPSKKeyRequested(java.lang.String identityHint, byte[] identityBytesOut, byte[] key)
-
serverPSKKeyRequested
int serverPSKKeyRequested(java.lang.String identityHint, java.lang.String identity, byte[] key)
-
chooseClientCertificate
void chooseClientCertificate(byte[] keyTypeBytes, int[] signatureAlgs, byte[][] asn1DerEncodedPrincipals) throws javax.net.ssl.SSLException, java.security.cert.CertificateEncodingException- Throws:
javax.net.ssl.SSLExceptionjava.security.cert.CertificateEncodingException
-
setCertificate
private void setCertificate(java.lang.String alias) throws java.security.cert.CertificateEncodingException, javax.net.ssl.SSLException- Throws:
java.security.cert.CertificateEncodingExceptionjavax.net.ssl.SSLException
-
getVersion
java.lang.String getVersion()
-
getRequestedServerName
java.lang.String getRequestedServerName()
-
getTlsChannelId
byte[] getTlsChannelId() throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
initialize
void initialize(java.lang.String hostname, OpenSSLKey channelIdPrivateKey) throws java.io.IOException- Throws:
java.io.IOException
-
configureServerCertificate
void configureServerCertificate() throws java.io.IOException- Throws:
java.io.IOException
-
verifyWithSniMatchers
private void verifyWithSniMatchers(java.lang.String serverName) throws javax.net.ssl.SSLHandshakeException- Throws:
javax.net.ssl.SSLHandshakeException
-
getCipherKeyTypes
private java.util.Set<java.lang.String> getCipherKeyTypes()
-
doHandshake
void doHandshake(java.io.FileDescriptor fd, int timeoutMillis) throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.security.cert.CertificateExceptionjava.io.IOException
-
doHandshake
int doHandshake() throws java.io.IOException- Throws:
java.io.IOException
-
read
int read(java.io.FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis) throws java.io.IOException- Throws:
java.io.IOException
-
write
void write(java.io.FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis) throws java.io.IOException- Throws:
java.io.IOException
-
enablePSKKeyManagerIfRequested
private void enablePSKKeyManagerIfRequested() throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
setTlsChannelId
private void setTlsChannelId(OpenSSLKey channelIdPrivateKey) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
setCertificateValidation
private void setCertificateValidation() throws javax.net.ssl.SSLException- Throws:
javax.net.ssl.SSLException
-
interrupt
void interrupt()
-
shutdown
void shutdown(java.io.FileDescriptor fd) throws java.io.IOException- Throws:
java.io.IOException
-
shutdown
void shutdown() throws java.io.IOException- Throws:
java.io.IOException
-
wasShutdownReceived
boolean wasShutdownReceived()
-
wasShutdownSent
boolean wasShutdownSent()
-
readDirectByteBuffer
int readDirectByteBuffer(long destAddress, int destLength) throws java.io.IOException, java.security.cert.CertificateException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
writeDirectByteBuffer
int writeDirectByteBuffer(long sourceAddress, int sourceLength) throws java.io.IOException- Throws:
java.io.IOException
-
forceRead
void forceRead() throws java.io.IOException- Throws:
java.io.IOException
-
getPendingReadableBytes
int getPendingReadableBytes()
-
getMaxSealOverhead
int getMaxSealOverhead()
-
close
void close()
-
isClosed
boolean isClosed()
-
getError
int getError(int result)
-
getApplicationProtocol
byte[] getApplicationProtocol()
-
isClient
private boolean isClient()
-
finalize
protected final void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-