Package org.conscrypt
Class NativeSsl
java.lang.Object
org.conscrypt.NativeSsl
A utility wrapper that abstracts operations on the underlying native SSL instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final classA utility wrapper that abstracts operations on the underlying native BIO instance. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SSLParametersImpl.AliasChooserprivate final NativeCrypto.SSLHandshakeCallbacksprivate X509Certificate[]private final ReadWriteLockprivate final SSLParametersImplprivate static int[]private final SSLParametersImpl.PSKCallbacksprivate longprivate static String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateNativeSsl(long ssl, SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser aliasChooser, SSLParametersImpl.PSKCallbacks pskCallbacks) -
Method Summary
Modifier and TypeMethodDescription(package private) voidchooseClientCertificate(byte[] keyTypeBytes, int[] signatureAlgs, byte[][] asn1DerEncodedPrincipals) (package private) intclientPSKKeyRequested(String identityHint, byte[] identityBytesOut, byte[] key) (package private) voidclose()(package private) void(package private) int(package private) voiddoHandshake(FileDescriptor fd, int timeoutMillis) private void(package private) byte[]exportKeyingMaterial(String label, byte[] context, int length) protected voidfinalize()(package private) void(package private) byte[](package private) String(package private) String(package private) intgetError(int result) (package private) X509Certificate[](package private) int(package private) static int[]Returns the parsed value of the "jdk.tls.namedGroups" property.(package private) byte[](package private) X509Certificate[](package private) byte[](package private) int(package private) String(package private) byte[](package private) longgetTime()(package private) long(package private) byte[](package private) byte[](package private) String(package private) voidinitialize(String hostname, OpenSSLKey channelIdPrivateKey) (package private) voidprivate 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) static int[]parseNamedGroupsProperty(String namedGroupsProperty) (package private) static voidParses the "jdk.tls.namedGroups" property and stores the result inparsedTlsNamedGroupsProperty.(package private) intread(FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis) (package private) intreadDirectByteBuffer(long destAddress, int destLength) (package private) intserverPSKKeyRequested(String identityHint, String identity, byte[] key) private voidsetCertificate(String alias) private voidprivate static voidsetDefaultNamedGroups(long ssl, NativeSsl sslHolder) (package private) voidsetTimeout(long millis) private voidsetTlsChannelId(OpenSSLKey channelIdPrivateKey) (package private) voidshutdown()(package private) voidprivate static inttoBoringSslGroup(String javaNamedGroup) (package private) static int[]toBoringSslGroups(String[] javaNamedGroups) Converts a list of java named groups to an array of groups that can be passed to BoringSSL.private voidverifyWithSniMatchers(String serverName) (package private) boolean(package private) boolean(package private) voidwrite(FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis) (package private) intwriteDirectByteBuffer(long sourceAddress, int sourceLength)
-
Field Details
-
parameters
-
handshakeCallbacks
-
aliasChooser
-
pskCallbacks
-
localCertificates
-
lock
-
ssl
private volatile long ssl -
parsedTlsNamedGroupsProperty
private static int[] parsedTlsNamedGroupsProperty -
unparsedTlsNamedGroupsProperty
-
-
Constructor Details
-
NativeSsl
private NativeSsl(long ssl, SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser aliasChooser, SSLParametersImpl.PSKCallbacks pskCallbacks)
-
-
Method Details
-
newInstance
static NativeSsl newInstance(SSLParametersImpl parameters, NativeCrypto.SSLHandshakeCallbacks handshakeCallbacks, SSLParametersImpl.AliasChooser chooser, SSLParametersImpl.PSKCallbacks pskCallbacks) throws SSLException - Throws:
SSLException
-
newBio
NativeSsl.BioWrapper newBio() -
offerToResumeSession
- Throws:
SSLException
-
getSessionId
byte[] getSessionId() -
getTime
long getTime() -
getTimeout
long getTimeout() -
setTimeout
void setTimeout(long millis) -
getCipherSuite
String getCipherSuite() -
getCurveNameForTesting
String getCurveNameForTesting() -
getPeerCertificates
- Throws:
CertificateException
-
getLocalCertificates
X509Certificate[] getLocalCertificates() -
getPeerCertificateOcspData
byte[] getPeerCertificateOcspData() -
getTlsUnique
byte[] getTlsUnique() -
exportKeyingMaterial
- Throws:
SSLException
-
getPeerTlsSctData
byte[] getPeerTlsSctData() -
clientPSKKeyRequested
-
serverPSKKeyRequested
-
chooseClientCertificate
void chooseClientCertificate(byte[] keyTypeBytes, int[] signatureAlgs, byte[][] asn1DerEncodedPrincipals) throws SSLException, CertificateEncodingException -
setCertificate
-
getVersion
String getVersion() -
getRequestedServerName
String getRequestedServerName() -
getTlsChannelId
- Throws:
SSLException
-
toBoringSslGroup
-
toBoringSslGroups
Converts a list of java named groups to an array of groups that can be passed to BoringSSL.Unknown groups are ignored, as required by the API documentation: SSLParameters.getNamedGroups()
-
parseNamedGroupsProperty
-
setDefaultNamedGroups
-
initialize
- Throws:
IOException
-
configureServerCertificate
- Throws:
IOException
-
verifyWithSniMatchers
- Throws:
SSLHandshakeException
-
getCipherKeyTypes
-
doHandshake
- Throws:
CertificateExceptionIOException
-
doHandshake
- Throws:
IOException
-
read
- Throws:
IOException
-
write
void write(FileDescriptor fd, byte[] buf, int offset, int len, int timeoutMillis) throws IOException - Throws:
IOException
-
enablePSKKeyManagerIfRequested
- Throws:
SSLException
-
setTlsChannelId
- Throws:
SSLException
-
setCertificateValidation
- Throws:
SSLException
-
interrupt
void interrupt() -
shutdown
- Throws:
IOException
-
shutdown
- Throws:
IOException
-
wasShutdownReceived
boolean wasShutdownReceived() -
wasShutdownSent
boolean wasShutdownSent() -
readDirectByteBuffer
- Throws:
IOExceptionCertificateException
-
writeDirectByteBuffer
- Throws:
IOException
-
forceRead
- Throws:
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
-
getParsedTlsNamedGroupsPropertyOrNull
static int[] getParsedTlsNamedGroupsPropertyOrNull()Returns the parsed value of the "jdk.tls.namedGroups" property.Is null if the property is not set or empty.
-
parseTlsNamedGroupsProperty
static void parseTlsNamedGroupsProperty()Parses the "jdk.tls.namedGroups" property and stores the result inparsedTlsNamedGroupsProperty.May throw an
IllegalArgumentExceptionif the property contains invalid values.
-