Package org.bouncycastle.tls
Class TlsUtils
java.lang.Object
org.bouncycastle.tls.TlsUtils
Some helper functions for the TLS API.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte[]static final int[]static final long[]static final short[]static final String[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddIfSupported(Vector supportedGroups, TlsCrypto crypto, int namedGroup) static voidaddIfSupported(Vector supportedGroups, TlsCrypto crypto, int[] namedGroups) static voidaddIfSupported(Vector supportedAlgs, TlsCrypto crypto, SignatureAndHashAlgorithm alg) static booleanstatic byte[]calculateExporterSeed(SecurityParameters securityParameters, byte[] context) static voidcheckPeerSigAlgs(TlsContext context, TlsCertificate[] peerCertPath) Check the signature algorithm for certificates in the peer's CertPath as specified in RFC 5246 7.4.2, 7.4.4, 7.4.6 and similar rules for earlier TLS versions.static voidcheckUint16(int i) static voidcheckUint16(long i) static voidcheckUint24(int i) static voidcheckUint24(long i) static voidcheckUint32(long i) static voidcheckUint48(long i) static voidcheckUint64(long i) static voidcheckUint8(int i) static voidcheckUint8(long i) static voidcheckUint8(short i) static SignatureAndHashAlgorithmchooseSignatureAndHashAlgorithm(ProtocolVersion negotiatedVersion, Vector sigHashAlgs, short signatureAlgorithm) static SignatureAndHashAlgorithmchooseSignatureAndHashAlgorithm(TlsContext context, Vector sigHashAlgs, short signatureAlgorithm) static byte[]clone(byte[] data) static String[]static booleanconstantTimeAreEqual(int len, byte[] a, int aOff, byte[] b, int bOff) static booleancontainsAnySignatureAlgorithm(Vector supportedSignatureAlgorithms, short signatureAlgorithm) static booleancontainsNonAscii(byte[] bs) static booleanstatic booleancontainsSignatureAlgorithm(Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) static byte[]copyOfRangeExact(byte[] original, int from, int to) static byte[]decodeOpaque16(byte[] buf) static byte[]decodeOpaque16(byte[] buf, int minLength) static byte[]decodeOpaque8(byte[] buf) static byte[]decodeOpaque8(byte[] buf, int minLength) static intdecodeUint16(byte[] buf) static int[]decodeUint16ArrayWithUint8Length(byte[] buf) static longdecodeUint32(byte[] buf) static shortdecodeUint8(byte[] buf) static short[]decodeUint8ArrayWithUint8Length(byte[] buf) static byte[]encodeOpaque16(byte[] buf) static byte[]encodeOpaque24(byte[] buf) static byte[]encodeOpaque8(byte[] buf) static voidencodeSupportedSignatureAlgorithms(Vector supportedSignatureAlgorithms, OutputStream output) static byte[]encodeUint16(int uint) static byte[]encodeUint16ArrayWithUint16Length(int[] uints) static byte[]encodeUint16ArrayWithUint8Length(int[] uints) static byte[]encodeUint24(int uint) static byte[]encodeUint32(long uint) static byte[]encodeUint8(short uint) static byte[]encodeUint8ArrayWithUint8Length(short[] uints) static byte[]encodeVersion(ProtocolVersion version) static TlsSecretgenerateEncryptedPreMasterSecret(TlsContext context, TlsEncryptor encryptor, OutputStream output) Generate a pre_master_secret and send it encrypted to the server.static intgetCipherType(int cipherSuite) static intgetCommonCipherSuite13(ProtocolVersion negotiatedVersion, int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder) static int[]getCommonCipherSuites(int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder) static Vectorstatic Vectorstatic Vectorstatic SignatureAndHashAlgorithmgetDefaultSignatureAlgorithm(short signatureAlgorithm) static VectorgetDefaultSignatureAlgorithms(short signatureAlgorithm) static Vectorstatic intgetEncryptionAlgorithm(int cipherSuite) static intgetEncryptionAlgorithmType(int encryptionAlgorithm) static byte[]getExtensionData(Hashtable extensions, Integer extensionType) static intgetKeyExchangeAlgorithm(int cipherSuite) static VectorgetKeyExchangeAlgorithms(int[] cipherSuites) static shortgetLegacyClientCertType(short signatureAlgorithm) static shortgetLegacySignatureAlgorithmClient(short clientCertificateType) static shortgetLegacySignatureAlgorithmClientCert(short clientCertificateType) static shortgetLegacySignatureAlgorithmServer(int keyExchangeAlgorithm) static shortgetLegacySignatureAlgorithmServerCert(int keyExchangeAlgorithm) static Vectorstatic intgetMACAlgorithm(int cipherSuite) static ProtocolVersiongetMinimumVersion(int cipherSuite) static VectorgetNamedGroupRoles(int[] cipherSuites) static VectorgetNamedGroupRoles(Vector keyExchangeAlgorithms) static org.bouncycastle.asn1.ASN1ObjectIdentifiergetOIDForHashAlgorithm(short hashAlgorithm) static SignatureAndHashAlgorithmgetSignatureAndHashAlgorithm(TlsContext context, TlsCredentialedSigner signerCredentials) Deprecated.Will be removedstatic int[]getSupportedCipherSuites(TlsCrypto crypto, int[] suites) static int[]getSupportedCipherSuites(TlsCrypto crypto, int[] suites, int suitesCount) Deprecated.UsegetSupportedCipherSuites(TlsCrypto, int[], int, int)instead.static int[]getSupportedCipherSuites(TlsCrypto crypto, int[] suites, int suitesOff, int suitesCount) static VectorgetSupportedSignatureAlgorithms(TlsContext context, Vector candidates) static VectorgetUsableSignatureAlgorithms(Vector sigHashAlgs) static booleanhasExpectedEmptyExtensionData(Hashtable extensions, Integer extensionType, short alertDescription) static booleanhasSigningCapability(short clientCertificateType) static TlsSessionimportSession(byte[] sessionID, SessionParameters sessionParameters) static booleanisAEADCipherSuite(int cipherSuite) static booleanisBlockCipherSuite(int cipherSuite) static booleanisNullOrContainsNull(Object[] array) static booleanisNullOrEmpty(byte[] array) static booleanisNullOrEmpty(int[] array) static booleanisNullOrEmpty(short[] array) static booleanisNullOrEmpty(Object[] array) static booleanstatic booleanstatic booleanstatic booleanisSSL(TlsContext context) static booleanisStreamCipherSuite(int cipherSuite) static booleanisSupportedCipherSuite(TlsCrypto crypto, int cipherSuite) static booleanisSupportedKeyExchange(TlsCrypto crypto, int keyExchangeAlgorithm) static booleanisTLSv10(ProtocolVersion version) static booleanisTLSv10(TlsContext context) static booleanisTLSv11(ProtocolVersion version) static booleanisTLSv11(TlsContext context) static booleanisTLSv12(ProtocolVersion version) static booleanisTLSv12(TlsContext context) static booleanisTLSv13(ProtocolVersion version) static booleanisTLSv13(TlsContext context) static booleanisValidCipherSuiteForSignatureAlgorithms(int cipherSuite, Vector sigAlgs) static booleanisValidCipherSuiteForVersion(int cipherSuite, ProtocolVersion version) Deprecated.UseisValidVersionForCipherSuite(int, ProtocolVersion)instead.static booleanisValidSignatureSchemeForServerKeyExchange(int signatureScheme, int keyExchangeAlgorithm) static booleanisValidUint16(int i) static booleanisValidUint16(long i) static booleanisValidUint24(int i) static booleanisValidUint24(long i) static booleanisValidUint32(long i) static booleanisValidUint48(long i) static booleanisValidUint64(long i) static booleanisValidUint8(int i) static booleanisValidUint8(long i) static booleanisValidUint8(short i) static booleanisValidVersionForCipherSuite(int cipherSuite, ProtocolVersion version) static Vectorstatic TlsSecretPRF(SecurityParameters securityParameters, TlsSecret secret, String asciiLabel, byte[] seed, int length) static TlsSecretPRF(TlsContext context, TlsSecret secret, String asciiLabel, byte[] seed, int length) Deprecated.static byte[]readAllOrNothing(int length, InputStream input) static org.bouncycastle.asn1.ASN1PrimitivereadASN1Object(byte[] encoding) static org.bouncycastle.asn1.ASN1PrimitivereadDERObject(byte[] encoding) Deprecated.Will be removed.static voidreadFully(byte[] buf, InputStream input) static byte[]readFully(int length, InputStream input) static intreadInt32(byte[] buf, int offset) static byte[]readOpaque16(InputStream input) static byte[]readOpaque16(InputStream input, int minLength) static byte[]readOpaque24(InputStream input) static byte[]readOpaque24(InputStream input, int minLength) static byte[]readOpaque8(InputStream input) static byte[]readOpaque8(InputStream input, int minLength) static byte[]readOpaque8(InputStream input, int minLength, int maxLength) static intreadUint16(byte[] buf, int offset) static intreadUint16(InputStream input) static int[]readUint16Array(int count, InputStream input) static intreadUint24(byte[] buf, int offset) static intreadUint24(InputStream input) static longreadUint32(byte[] buf, int offset) static longreadUint32(InputStream input) static longreadUint48(byte[] buf, int offset) static longreadUint48(InputStream input) static shortreadUint8(byte[] buf, int offset) static shortreadUint8(InputStream input) static short[]readUint8Array(int count, InputStream input) static short[]readUint8ArrayWithUint8Length(InputStream input, int minLength) static ProtocolVersionreadVersion(byte[] buf, int offset) static ProtocolVersionreadVersion(InputStream input) static voidrequireDEREncoding(org.bouncycastle.asn1.ASN1Object asn1, byte[] encoding) static VectorvectorOfOne(Object obj) static voidverifySupportedSignatureAlgorithm(Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) static voidwriteGMTUnixTime(byte[] buf, int offset) static voidwriteOpaque16(byte[] data, byte[] buf, int off) static voidwriteOpaque16(byte[] buf, OutputStream output) static voidwriteOpaque24(byte[] data, byte[] buf, int off) static voidwriteOpaque24(byte[] buf, OutputStream output) static voidwriteOpaque8(byte[] data, byte[] buf, int off) static voidwriteOpaque8(byte[] buf, OutputStream output) static voidwriteUint16(int i, byte[] buf, int offset) static voidwriteUint16(int i, OutputStream output) static voidwriteUint16Array(int[] uints, byte[] buf, int offset) static voidwriteUint16Array(int[] uints, OutputStream output) static voidwriteUint16ArrayWithUint16Length(int[] uints, byte[] buf, int offset) static voidwriteUint16ArrayWithUint16Length(int[] uints, OutputStream output) static voidwriteUint16ArrayWithUint8Length(int[] uints, byte[] buf, int offset) static voidwriteUint24(int i, byte[] buf, int offset) static voidwriteUint24(int i, OutputStream output) static voidwriteUint32(long i, byte[] buf, int offset) static voidwriteUint32(long i, OutputStream output) static voidwriteUint48(long i, byte[] buf, int offset) static voidwriteUint48(long i, OutputStream output) static voidwriteUint64(long i, byte[] buf, int offset) static voidwriteUint64(long i, OutputStream output) static voidwriteUint8(int i, byte[] buf, int offset) static voidwriteUint8(int i, OutputStream output) static voidwriteUint8(short i, byte[] buf, int offset) static voidwriteUint8(short i, OutputStream output) static voidwriteUint8Array(short[] uints, byte[] buf, int offset) static voidwriteUint8Array(short[] uints, OutputStream output) static voidwriteUint8ArrayWithUint8Length(short[] uints, byte[] buf, int offset) static voidwriteUint8ArrayWithUint8Length(short[] uints, OutputStream output) static voidwriteVersion(ProtocolVersion version, byte[] buf, int offset) static voidwriteVersion(ProtocolVersion version, OutputStream output)
-
Field Details
-
EMPTY_BYTES
public static final byte[] EMPTY_BYTES -
EMPTY_SHORTS
public static final short[] EMPTY_SHORTS -
EMPTY_INTS
public static final int[] EMPTY_INTS -
EMPTY_LONGS
public static final long[] EMPTY_LONGS -
EMPTY_STRINGS
-
-
Constructor Details
-
TlsUtils
public TlsUtils()
-
-
Method Details
-
checkUint8
- Throws:
IOException
-
checkUint8
- Throws:
IOException
-
checkUint8
- Throws:
IOException
-
checkUint16
- Throws:
IOException
-
checkUint16
- Throws:
IOException
-
checkUint24
- Throws:
IOException
-
checkUint24
- Throws:
IOException
-
checkUint32
- Throws:
IOException
-
checkUint48
- Throws:
IOException
-
checkUint64
- Throws:
IOException
-
isValidUint8
public static boolean isValidUint8(short i) -
isValidUint8
public static boolean isValidUint8(int i) -
isValidUint8
public static boolean isValidUint8(long i) -
isValidUint16
public static boolean isValidUint16(int i) -
isValidUint16
public static boolean isValidUint16(long i) -
isValidUint24
public static boolean isValidUint24(int i) -
isValidUint24
public static boolean isValidUint24(long i) -
isValidUint32
public static boolean isValidUint32(long i) -
isValidUint48
public static boolean isValidUint48(long i) -
isValidUint64
public static boolean isValidUint64(long i) -
isSSL
-
isTLSv10
-
isTLSv10
-
isTLSv11
-
isTLSv11
-
isTLSv12
-
isTLSv12
-
isTLSv13
-
isTLSv13
-
writeUint8
- Throws:
IOException
-
writeUint8
- Throws:
IOException
-
writeUint8
public static void writeUint8(short i, byte[] buf, int offset) -
writeUint8
public static void writeUint8(int i, byte[] buf, int offset) -
writeUint16
- Throws:
IOException
-
writeUint16
public static void writeUint16(int i, byte[] buf, int offset) -
writeUint24
- Throws:
IOException
-
writeUint24
public static void writeUint24(int i, byte[] buf, int offset) -
writeUint32
- Throws:
IOException
-
writeUint32
public static void writeUint32(long i, byte[] buf, int offset) -
writeUint48
- Throws:
IOException
-
writeUint48
public static void writeUint48(long i, byte[] buf, int offset) -
writeUint64
- Throws:
IOException
-
writeUint64
public static void writeUint64(long i, byte[] buf, int offset) -
writeOpaque8
- Throws:
IOException
-
writeOpaque8
- Throws:
IOException
-
writeOpaque16
- Throws:
IOException
-
writeOpaque16
- Throws:
IOException
-
writeOpaque24
- Throws:
IOException
-
writeOpaque24
- Throws:
IOException
-
writeUint8Array
- Throws:
IOException
-
writeUint8Array
- Throws:
IOException
-
writeUint8ArrayWithUint8Length
public static void writeUint8ArrayWithUint8Length(short[] uints, OutputStream output) throws IOException - Throws:
IOException
-
writeUint8ArrayWithUint8Length
public static void writeUint8ArrayWithUint8Length(short[] uints, byte[] buf, int offset) throws IOException - Throws:
IOException
-
writeUint16Array
- Throws:
IOException
-
writeUint16Array
- Throws:
IOException
-
writeUint16ArrayWithUint8Length
public static void writeUint16ArrayWithUint8Length(int[] uints, byte[] buf, int offset) throws IOException - Throws:
IOException
-
writeUint16ArrayWithUint16Length
public static void writeUint16ArrayWithUint16Length(int[] uints, OutputStream output) throws IOException - Throws:
IOException
-
writeUint16ArrayWithUint16Length
public static void writeUint16ArrayWithUint16Length(int[] uints, byte[] buf, int offset) throws IOException - Throws:
IOException
-
decodeOpaque8
- Throws:
IOException
-
decodeOpaque8
- Throws:
IOException
-
decodeOpaque16
- Throws:
IOException
-
decodeOpaque16
- Throws:
IOException
-
decodeUint8
- Throws:
IOException
-
decodeUint8ArrayWithUint8Length
- Throws:
IOException
-
decodeUint16
- Throws:
IOException
-
decodeUint16ArrayWithUint8Length
- Throws:
IOException
-
decodeUint32
- Throws:
IOException
-
encodeOpaque8
- Throws:
IOException
-
encodeOpaque16
- Throws:
IOException
-
encodeOpaque24
- Throws:
IOException
-
encodeUint8
- Throws:
IOException
-
encodeUint8ArrayWithUint8Length
- Throws:
IOException
-
encodeUint16
- Throws:
IOException
-
encodeUint16ArrayWithUint8Length
- Throws:
IOException
-
encodeUint16ArrayWithUint16Length
- Throws:
IOException
-
encodeUint24
- Throws:
IOException
-
encodeUint32
- Throws:
IOException
-
encodeVersion
- Throws:
IOException
-
readInt32
public static int readInt32(byte[] buf, int offset) -
readUint8
- Throws:
IOException
-
readUint8
public static short readUint8(byte[] buf, int offset) -
readUint16
- Throws:
IOException
-
readUint16
public static int readUint16(byte[] buf, int offset) -
readUint24
- Throws:
IOException
-
readUint24
public static int readUint24(byte[] buf, int offset) -
readUint32
- Throws:
IOException
-
readUint32
public static long readUint32(byte[] buf, int offset) -
readUint48
- Throws:
IOException
-
readUint48
public static long readUint48(byte[] buf, int offset) -
readAllOrNothing
- Throws:
IOException
-
readFully
- Throws:
IOException
-
readFully
- Throws:
IOException
-
readOpaque8
- Throws:
IOException
-
readOpaque8
- Throws:
IOException
-
readOpaque8
public static byte[] readOpaque8(InputStream input, int minLength, int maxLength) throws IOException - Throws:
IOException
-
readOpaque16
- Throws:
IOException
-
readOpaque16
- Throws:
IOException
-
readOpaque24
- Throws:
IOException
-
readOpaque24
- Throws:
IOException
-
readUint8Array
- Throws:
IOException
-
readUint8ArrayWithUint8Length
public static short[] readUint8ArrayWithUint8Length(InputStream input, int minLength) throws IOException - Throws:
IOException
-
readUint16Array
- Throws:
IOException
-
readVersion
-
readVersion
- Throws:
IOException
-
readASN1Object
public static org.bouncycastle.asn1.ASN1Primitive readASN1Object(byte[] encoding) throws IOException - Throws:
IOException
-
readDERObject
Deprecated.Will be removed. Use readASN1Object in combination with requireDEREncoding instead- Throws:
IOException
-
requireDEREncoding
public static void requireDEREncoding(org.bouncycastle.asn1.ASN1Object asn1, byte[] encoding) throws IOException - Throws:
IOException
-
writeGMTUnixTime
public static void writeGMTUnixTime(byte[] buf, int offset) -
writeVersion
- Throws:
IOException
-
writeVersion
-
addIfSupported
public static void addIfSupported(Vector supportedAlgs, TlsCrypto crypto, SignatureAndHashAlgorithm alg) -
addIfSupported
-
addIfSupported
-
addToSet
-
getDefaultDSSSignatureAlgorithms
-
getDefaultECDSASignatureAlgorithms
-
getDefaultRSASignatureAlgorithms
-
getDefaultSignatureAlgorithm
-
getDefaultSignatureAlgorithms
-
getDefaultSupportedSignatureAlgorithms
-
getSupportedSignatureAlgorithms
-
getSignatureAndHashAlgorithm
public static SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(TlsContext context, TlsCredentialedSigner signerCredentials) throws IOException Deprecated.Will be removed- Throws:
IOException
-
getExtensionData
-
hasExpectedEmptyExtensionData
public static boolean hasExpectedEmptyExtensionData(Hashtable extensions, Integer extensionType, short alertDescription) throws IOException - Throws:
IOException
-
importSession
-
isNullOrContainsNull
-
isNullOrEmpty
public static boolean isNullOrEmpty(byte[] array) -
isNullOrEmpty
public static boolean isNullOrEmpty(short[] array) -
isNullOrEmpty
public static boolean isNullOrEmpty(int[] array) -
isNullOrEmpty
-
isNullOrEmpty
-
isNullOrEmpty
-
isSignatureAlgorithmsExtensionAllowed
-
getLegacyClientCertType
public static short getLegacyClientCertType(short signatureAlgorithm) -
getLegacySignatureAlgorithmClient
public static short getLegacySignatureAlgorithmClient(short clientCertificateType) -
getLegacySignatureAlgorithmClientCert
public static short getLegacySignatureAlgorithmClientCert(short clientCertificateType) -
getLegacySignatureAlgorithmServer
public static short getLegacySignatureAlgorithmServer(int keyExchangeAlgorithm) -
getLegacySignatureAlgorithmServerCert
public static short getLegacySignatureAlgorithmServerCert(int keyExchangeAlgorithm) -
getLegacySupportedSignatureAlgorithms
-
encodeSupportedSignatureAlgorithms
public static void encodeSupportedSignatureAlgorithms(Vector supportedSignatureAlgorithms, OutputStream output) throws IOException - Throws:
IOException
-
parseSupportedSignatureAlgorithms
- Throws:
IOException
-
verifySupportedSignatureAlgorithm
public static void verifySupportedSignatureAlgorithm(Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) throws IOException - Throws:
IOException
-
containsSignatureAlgorithm
public static boolean containsSignatureAlgorithm(Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) throws IOException - Throws:
IOException
-
containsAnySignatureAlgorithm
public static boolean containsAnySignatureAlgorithm(Vector supportedSignatureAlgorithms, short signatureAlgorithm) -
PRF
public static TlsSecret PRF(SecurityParameters securityParameters, TlsSecret secret, String asciiLabel, byte[] seed, int length) -
PRF
public static TlsSecret PRF(TlsContext context, TlsSecret secret, String asciiLabel, byte[] seed, int length) Deprecated. -
clone
public static byte[] clone(byte[] data) -
clone
-
constantTimeAreEqual
public static boolean constantTimeAreEqual(int len, byte[] a, int aOff, byte[] b, int bOff) -
copyOfRangeExact
public static byte[] copyOfRangeExact(byte[] original, int from, int to) -
calculateExporterSeed
-
getOIDForHashAlgorithm
public static org.bouncycastle.asn1.ASN1ObjectIdentifier getOIDForHashAlgorithm(short hashAlgorithm) -
hasSigningCapability
public static boolean hasSigningCapability(short clientCertificateType) -
vectorOfOne
-
getCipherType
public static int getCipherType(int cipherSuite) -
getEncryptionAlgorithm
public static int getEncryptionAlgorithm(int cipherSuite) -
getEncryptionAlgorithmType
public static int getEncryptionAlgorithmType(int encryptionAlgorithm) -
getKeyExchangeAlgorithm
public static int getKeyExchangeAlgorithm(int cipherSuite) -
getKeyExchangeAlgorithms
-
getMACAlgorithm
public static int getMACAlgorithm(int cipherSuite) -
getMinimumVersion
-
getNamedGroupRoles
-
getNamedGroupRoles
-
isAEADCipherSuite
- Throws:
IOException
-
isBlockCipherSuite
- Throws:
IOException
-
isStreamCipherSuite
- Throws:
IOException
-
isValidCipherSuiteForSignatureAlgorithms
- Returns:
- Whether a server can select the specified cipher suite given the available signature algorithms for ServerKeyExchange.
-
isValidCipherSuiteForVersion
Deprecated.UseisValidVersionForCipherSuite(int, ProtocolVersion)instead. -
isValidSignatureSchemeForServerKeyExchange
public static boolean isValidSignatureSchemeForServerKeyExchange(int signatureScheme, int keyExchangeAlgorithm) -
isValidVersionForCipherSuite
-
chooseSignatureAndHashAlgorithm
public static SignatureAndHashAlgorithm chooseSignatureAndHashAlgorithm(TlsContext context, Vector sigHashAlgs, short signatureAlgorithm) throws IOException - Throws:
IOException
-
chooseSignatureAndHashAlgorithm
public static SignatureAndHashAlgorithm chooseSignatureAndHashAlgorithm(ProtocolVersion negotiatedVersion, Vector sigHashAlgs, short signatureAlgorithm) throws IOException - Throws:
IOException
-
getUsableSignatureAlgorithms
-
getCommonCipherSuite13
public static int getCommonCipherSuite13(ProtocolVersion negotiatedVersion, int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder) -
getCommonCipherSuites
public static int[] getCommonCipherSuites(int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder) -
getSupportedCipherSuites
-
getSupportedCipherSuites
Deprecated.UsegetSupportedCipherSuites(TlsCrypto, int[], int, int)instead. -
getSupportedCipherSuites
public static int[] getSupportedCipherSuites(TlsCrypto crypto, int[] suites, int suitesOff, int suitesCount) -
isSupportedCipherSuite
-
isSupportedKeyExchange
-
checkPeerSigAlgs
public static void checkPeerSigAlgs(TlsContext context, TlsCertificate[] peerCertPath) throws IOException Check the signature algorithm for certificates in the peer's CertPath as specified in RFC 5246 7.4.2, 7.4.4, 7.4.6 and similar rules for earlier TLS versions. The supplied CertPath should include the trust anchor (its signature algorithm isn't checked, but in the general case checking a certificate requires the issuer certificate).- Throws:
IOException- if any certificate in the CertPath (excepting the trust anchor) has a signature algorithm that is not one of the locally supported signature algorithms.
-
containsNonAscii
public static boolean containsNonAscii(byte[] bs) -
containsNonAscii
-
generateEncryptedPreMasterSecret
public static TlsSecret generateEncryptedPreMasterSecret(TlsContext context, TlsEncryptor encryptor, OutputStream output) throws IOException Generate a pre_master_secret and send it encrypted to the server.- Throws:
IOException
-