Package org.bouncycastle.tls
Class TlsUtils
java.lang.Object
org.bouncycastle.tls.TlsUtils
Some helper functions for the TLS API.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte[]
static final int[]
static final long[]
static final short[]
static final String[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addIfSupported
(Vector supportedGroups, TlsCrypto crypto, int namedGroup) static void
addIfSupported
(Vector supportedGroups, TlsCrypto crypto, int[] namedGroups) static void
addIfSupported
(Vector supportedAlgs, TlsCrypto crypto, SignatureAndHashAlgorithm alg) static boolean
static byte[]
calculateExporterSeed
(SecurityParameters securityParameters, byte[] context) static void
checkPeerSigAlgs
(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 void
checkUint16
(int i) static void
checkUint16
(long i) static void
checkUint24
(int i) static void
checkUint24
(long i) static void
checkUint32
(long i) static void
checkUint48
(long i) static void
checkUint64
(long i) static void
checkUint8
(int i) static void
checkUint8
(long i) static void
checkUint8
(short i) static SignatureAndHashAlgorithm
chooseSignatureAndHashAlgorithm
(ProtocolVersion negotiatedVersion, Vector sigHashAlgs, short signatureAlgorithm) static SignatureAndHashAlgorithm
chooseSignatureAndHashAlgorithm
(TlsContext context, Vector sigHashAlgs, short signatureAlgorithm) static byte[]
clone
(byte[] data) static String[]
static boolean
constantTimeAreEqual
(int len, byte[] a, int aOff, byte[] b, int bOff) static boolean
containsAnySignatureAlgorithm
(Vector supportedSignatureAlgorithms, short signatureAlgorithm) static boolean
containsNonAscii
(byte[] bs) static boolean
static boolean
containsSignatureAlgorithm
(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 int
decodeUint16
(byte[] buf) static int[]
decodeUint16ArrayWithUint8Length
(byte[] buf) static long
decodeUint32
(byte[] buf) static short
decodeUint8
(byte[] buf) static short[]
decodeUint8ArrayWithUint8Length
(byte[] buf) static byte[]
encodeOpaque16
(byte[] buf) static byte[]
encodeOpaque24
(byte[] buf) static byte[]
encodeOpaque8
(byte[] buf) static void
encodeSupportedSignatureAlgorithms
(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 TlsSecret
generateEncryptedPreMasterSecret
(TlsContext context, TlsEncryptor encryptor, OutputStream output) Generate a pre_master_secret and send it encrypted to the server.static int
getCipherType
(int cipherSuite) static int
getCommonCipherSuite13
(ProtocolVersion negotiatedVersion, int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder) static int[]
getCommonCipherSuites
(int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder) static Vector
static Vector
static Vector
static SignatureAndHashAlgorithm
getDefaultSignatureAlgorithm
(short signatureAlgorithm) static Vector
getDefaultSignatureAlgorithms
(short signatureAlgorithm) static Vector
static int
getEncryptionAlgorithm
(int cipherSuite) static int
getEncryptionAlgorithmType
(int encryptionAlgorithm) static byte[]
getExtensionData
(Hashtable extensions, Integer extensionType) static int
getKeyExchangeAlgorithm
(int cipherSuite) static Vector
getKeyExchangeAlgorithms
(int[] cipherSuites) static short
getLegacyClientCertType
(short signatureAlgorithm) static short
getLegacySignatureAlgorithmClient
(short clientCertificateType) static short
getLegacySignatureAlgorithmClientCert
(short clientCertificateType) static short
getLegacySignatureAlgorithmServer
(int keyExchangeAlgorithm) static short
getLegacySignatureAlgorithmServerCert
(int keyExchangeAlgorithm) static Vector
static int
getMACAlgorithm
(int cipherSuite) static ProtocolVersion
getMinimumVersion
(int cipherSuite) static Vector
getNamedGroupRoles
(int[] cipherSuites) static Vector
getNamedGroupRoles
(Vector keyExchangeAlgorithms) static org.bouncycastle.asn1.ASN1ObjectIdentifier
getOIDForHashAlgorithm
(short hashAlgorithm) static SignatureAndHashAlgorithm
getSignatureAndHashAlgorithm
(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 Vector
getSupportedSignatureAlgorithms
(TlsContext context, Vector candidates) static Vector
getUsableSignatureAlgorithms
(Vector sigHashAlgs) static boolean
hasExpectedEmptyExtensionData
(Hashtable extensions, Integer extensionType, short alertDescription) static boolean
hasSigningCapability
(short clientCertificateType) static TlsSession
importSession
(byte[] sessionID, SessionParameters sessionParameters) static boolean
isAEADCipherSuite
(int cipherSuite) static boolean
isBlockCipherSuite
(int cipherSuite) static boolean
isNullOrContainsNull
(Object[] array) static boolean
isNullOrEmpty
(byte[] array) static boolean
isNullOrEmpty
(int[] array) static boolean
isNullOrEmpty
(short[] array) static boolean
isNullOrEmpty
(Object[] array) static boolean
static boolean
static boolean
static boolean
isSSL
(TlsContext context) static boolean
isStreamCipherSuite
(int cipherSuite) static boolean
isSupportedCipherSuite
(TlsCrypto crypto, int cipherSuite) static boolean
isSupportedKeyExchange
(TlsCrypto crypto, int keyExchangeAlgorithm) static boolean
isTLSv10
(ProtocolVersion version) static boolean
isTLSv10
(TlsContext context) static boolean
isTLSv11
(ProtocolVersion version) static boolean
isTLSv11
(TlsContext context) static boolean
isTLSv12
(ProtocolVersion version) static boolean
isTLSv12
(TlsContext context) static boolean
isTLSv13
(ProtocolVersion version) static boolean
isTLSv13
(TlsContext context) static boolean
isValidCipherSuiteForSignatureAlgorithms
(int cipherSuite, Vector sigAlgs) static boolean
isValidCipherSuiteForVersion
(int cipherSuite, ProtocolVersion version) Deprecated.UseisValidVersionForCipherSuite(int, ProtocolVersion)
instead.static boolean
isValidSignatureSchemeForServerKeyExchange
(int signatureScheme, int keyExchangeAlgorithm) static boolean
isValidUint16
(int i) static boolean
isValidUint16
(long i) static boolean
isValidUint24
(int i) static boolean
isValidUint24
(long i) static boolean
isValidUint32
(long i) static boolean
isValidUint48
(long i) static boolean
isValidUint64
(long i) static boolean
isValidUint8
(int i) static boolean
isValidUint8
(long i) static boolean
isValidUint8
(short i) static boolean
isValidVersionForCipherSuite
(int cipherSuite, ProtocolVersion version) static Vector
static TlsSecret
PRF
(SecurityParameters securityParameters, TlsSecret secret, String asciiLabel, byte[] seed, int length) static TlsSecret
PRF
(TlsContext context, TlsSecret secret, String asciiLabel, byte[] seed, int length) Deprecated.static byte[]
readAllOrNothing
(int length, InputStream input) static org.bouncycastle.asn1.ASN1Primitive
readASN1Object
(byte[] encoding) static org.bouncycastle.asn1.ASN1Primitive
readDERObject
(byte[] encoding) Deprecated.Will be removed.static void
readFully
(byte[] buf, InputStream input) static byte[]
readFully
(int length, InputStream input) static int
readInt32
(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 int
readUint16
(byte[] buf, int offset) static int
readUint16
(InputStream input) static int[]
readUint16Array
(int count, InputStream input) static int
readUint24
(byte[] buf, int offset) static int
readUint24
(InputStream input) static long
readUint32
(byte[] buf, int offset) static long
readUint32
(InputStream input) static long
readUint48
(byte[] buf, int offset) static long
readUint48
(InputStream input) static short
readUint8
(byte[] buf, int offset) static short
readUint8
(InputStream input) static short[]
readUint8Array
(int count, InputStream input) static short[]
readUint8ArrayWithUint8Length
(InputStream input, int minLength) static ProtocolVersion
readVersion
(byte[] buf, int offset) static ProtocolVersion
readVersion
(InputStream input) static void
requireDEREncoding
(org.bouncycastle.asn1.ASN1Object asn1, byte[] encoding) static Vector
vectorOfOne
(Object obj) static void
verifySupportedSignatureAlgorithm
(Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) static void
writeGMTUnixTime
(byte[] buf, int offset) static void
writeOpaque16
(byte[] data, byte[] buf, int off) static void
writeOpaque16
(byte[] buf, OutputStream output) static void
writeOpaque24
(byte[] data, byte[] buf, int off) static void
writeOpaque24
(byte[] buf, OutputStream output) static void
writeOpaque8
(byte[] data, byte[] buf, int off) static void
writeOpaque8
(byte[] buf, OutputStream output) static void
writeUint16
(int i, byte[] buf, int offset) static void
writeUint16
(int i, OutputStream output) static void
writeUint16Array
(int[] uints, byte[] buf, int offset) static void
writeUint16Array
(int[] uints, OutputStream output) static void
writeUint16ArrayWithUint16Length
(int[] uints, byte[] buf, int offset) static void
writeUint16ArrayWithUint16Length
(int[] uints, OutputStream output) static void
writeUint16ArrayWithUint8Length
(int[] uints, byte[] buf, int offset) static void
writeUint24
(int i, byte[] buf, int offset) static void
writeUint24
(int i, OutputStream output) static void
writeUint32
(long i, byte[] buf, int offset) static void
writeUint32
(long i, OutputStream output) static void
writeUint48
(long i, byte[] buf, int offset) static void
writeUint48
(long i, OutputStream output) static void
writeUint64
(long i, byte[] buf, int offset) static void
writeUint64
(long i, OutputStream output) static void
writeUint8
(int i, byte[] buf, int offset) static void
writeUint8
(int i, OutputStream output) static void
writeUint8
(short i, byte[] buf, int offset) static void
writeUint8
(short i, OutputStream output) static void
writeUint8Array
(short[] uints, byte[] buf, int offset) static void
writeUint8Array
(short[] uints, OutputStream output) static void
writeUint8ArrayWithUint8Length
(short[] uints, byte[] buf, int offset) static void
writeUint8ArrayWithUint8Length
(short[] uints, OutputStream output) static void
writeVersion
(ProtocolVersion version, byte[] buf, int offset) static void
writeVersion
(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
-