public class TlsUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static byte[] |
EMPTY_BYTES |
static int[] |
EMPTY_INTS |
static long[] |
EMPTY_LONGS |
static short[] |
EMPTY_SHORTS |
static java.lang.String[] |
EMPTY_STRINGS |
Constructor and Description |
---|
TlsUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addIfSupported(java.util.Vector supportedGroups,
TlsCrypto crypto,
int namedGroup) |
static void |
addIfSupported(java.util.Vector supportedGroups,
TlsCrypto crypto,
int[] namedGroups) |
static void |
addIfSupported(java.util.Vector supportedAlgs,
TlsCrypto crypto,
SignatureAndHashAlgorithm alg) |
static boolean |
addToSet(java.util.Vector s,
int i) |
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,
java.util.Vector sigHashAlgs,
short signatureAlgorithm) |
static SignatureAndHashAlgorithm |
chooseSignatureAndHashAlgorithm(TlsContext context,
java.util.Vector sigHashAlgs,
short signatureAlgorithm) |
static byte[] |
clone(byte[] data) |
static java.lang.String[] |
clone(java.lang.String[] s) |
static boolean |
constantTimeAreEqual(int len,
byte[] a,
int aOff,
byte[] b,
int bOff) |
static boolean |
containsAnySignatureAlgorithm(java.util.Vector supportedSignatureAlgorithms,
short signatureAlgorithm) |
static boolean |
containsNonAscii(byte[] bs) |
static boolean |
containsNonAscii(java.lang.String s) |
static boolean |
containsSignatureAlgorithm(java.util.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(java.util.Vector supportedSignatureAlgorithms,
java.io.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,
java.io.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 java.util.Vector |
getDefaultDSSSignatureAlgorithms() |
static java.util.Vector |
getDefaultECDSASignatureAlgorithms() |
static java.util.Vector |
getDefaultRSASignatureAlgorithms() |
static SignatureAndHashAlgorithm |
getDefaultSignatureAlgorithm(short signatureAlgorithm) |
static java.util.Vector |
getDefaultSignatureAlgorithms(short signatureAlgorithm) |
static java.util.Vector |
getDefaultSupportedSignatureAlgorithms(TlsContext context) |
static int |
getEncryptionAlgorithm(int cipherSuite) |
static int |
getEncryptionAlgorithmType(int encryptionAlgorithm) |
static byte[] |
getExtensionData(java.util.Hashtable extensions,
java.lang.Integer extensionType) |
static short |
getHashAlgorithmForPRFAlgorithm(int prfAlgorithm)
Deprecated.
Will be removed.
TlsCryptoUtils.getHashForPRF(int) should be a useful alternative. |
static int |
getKeyExchangeAlgorithm(int cipherSuite) |
static java.util.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 java.util.Vector |
getLegacySupportedSignatureAlgorithms() |
static int |
getMACAlgorithm(int cipherSuite) |
static ProtocolVersion |
getMinimumVersion(int cipherSuite) |
static java.util.Vector |
getNamedGroupRoles(int[] cipherSuites) |
static java.util.Vector |
getNamedGroupRoles(java.util.Vector keyExchangeAlgorithms) |
static org.bouncycastle.asn1.ASN1ObjectIdentifier |
getOIDForHashAlgorithm(short hashAlgorithm) |
static SignatureAndHashAlgorithm |
getSignatureAndHashAlgorithm(TlsContext context,
TlsCredentialedSigner signerCredentials)
Deprecated.
Will be removed
|
static int[] |
getSupportedCipherSuites(TlsCrypto crypto,
int[] suites) |
static int[] |
getSupportedCipherSuites(TlsCrypto crypto,
int[] suites,
int suitesCount)
Deprecated.
Use
getSupportedCipherSuites(TlsCrypto, int[], int, int) instead. |
static int[] |
getSupportedCipherSuites(TlsCrypto crypto,
int[] suites,
int suitesOff,
int suitesCount) |
static java.util.Vector |
getSupportedSignatureAlgorithms(TlsContext context,
java.util.Vector candidates) |
static java.util.Vector |
getUsableSignatureAlgorithms(java.util.Vector sigHashAlgs) |
static boolean |
hasExpectedEmptyExtensionData(java.util.Hashtable extensions,
java.lang.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(java.lang.Object[] array) |
static boolean |
isNullOrEmpty(byte[] array) |
static boolean |
isNullOrEmpty(int[] array) |
static boolean |
isNullOrEmpty(java.lang.Object[] array) |
static boolean |
isNullOrEmpty(short[] array) |
static boolean |
isNullOrEmpty(java.lang.String s) |
static boolean |
isNullOrEmpty(java.util.Vector v) |
static boolean |
isSignatureAlgorithmsExtensionAllowed(ProtocolVersion version) |
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,
java.util.Vector sigAlgs) |
static boolean |
isValidCipherSuiteForVersion(int cipherSuite,
ProtocolVersion version)
Deprecated.
Use
isValidVersionForCipherSuite(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 java.util.Vector |
parseSupportedSignatureAlgorithms(java.io.InputStream input) |
static TlsSecret |
PRF(SecurityParameters securityParameters,
TlsSecret secret,
java.lang.String asciiLabel,
byte[] seed,
int length) |
static TlsSecret |
PRF(TlsContext context,
TlsSecret secret,
java.lang.String asciiLabel,
byte[] seed,
int length)
Deprecated.
|
static byte[] |
readAllOrNothing(int length,
java.io.InputStream input) |
static org.bouncycastle.asn1.ASN1Primitive |
readASN1Object(byte[] encoding) |
static org.bouncycastle.asn1.ASN1Primitive |
readDERObject(byte[] encoding)
Deprecated.
Will be removed. Use readASN1Object in combination with requireDEREncoding instead
|
static void |
readFully(byte[] buf,
java.io.InputStream input) |
static byte[] |
readFully(int length,
java.io.InputStream input) |
static int |
readInt32(byte[] buf,
int offset) |
static byte[] |
readOpaque16(java.io.InputStream input) |
static byte[] |
readOpaque16(java.io.InputStream input,
int minLength) |
static byte[] |
readOpaque24(java.io.InputStream input) |
static byte[] |
readOpaque24(java.io.InputStream input,
int minLength) |
static byte[] |
readOpaque8(java.io.InputStream input) |
static byte[] |
readOpaque8(java.io.InputStream input,
int minLength) |
static byte[] |
readOpaque8(java.io.InputStream input,
int minLength,
int maxLength) |
static int |
readUint16(byte[] buf,
int offset) |
static int |
readUint16(java.io.InputStream input) |
static int[] |
readUint16Array(int count,
java.io.InputStream input) |
static int |
readUint24(byte[] buf,
int offset) |
static int |
readUint24(java.io.InputStream input) |
static long |
readUint32(byte[] buf,
int offset) |
static long |
readUint32(java.io.InputStream input) |
static long |
readUint48(byte[] buf,
int offset) |
static long |
readUint48(java.io.InputStream input) |
static short |
readUint8(byte[] buf,
int offset) |
static short |
readUint8(java.io.InputStream input) |
static short[] |
readUint8Array(int count,
java.io.InputStream input) |
static short[] |
readUint8ArrayWithUint8Length(java.io.InputStream input,
int minLength) |
static ProtocolVersion |
readVersion(byte[] buf,
int offset) |
static ProtocolVersion |
readVersion(java.io.InputStream input) |
static void |
requireDEREncoding(org.bouncycastle.asn1.ASN1Object asn1,
byte[] encoding) |
static java.util.Vector |
vectorOfOne(java.lang.Object obj) |
static void |
verifySupportedSignatureAlgorithm(java.util.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,
java.io.OutputStream output) |
static void |
writeOpaque24(byte[] data,
byte[] buf,
int off) |
static void |
writeOpaque24(byte[] buf,
java.io.OutputStream output) |
static void |
writeOpaque8(byte[] data,
byte[] buf,
int off) |
static void |
writeOpaque8(byte[] buf,
java.io.OutputStream output) |
static void |
writeUint16(int i,
byte[] buf,
int offset) |
static void |
writeUint16(int i,
java.io.OutputStream output) |
static void |
writeUint16Array(int[] uints,
byte[] buf,
int offset) |
static void |
writeUint16Array(int[] uints,
java.io.OutputStream output) |
static void |
writeUint16ArrayWithUint16Length(int[] uints,
byte[] buf,
int offset) |
static void |
writeUint16ArrayWithUint16Length(int[] uints,
java.io.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,
java.io.OutputStream output) |
static void |
writeUint32(long i,
byte[] buf,
int offset) |
static void |
writeUint32(long i,
java.io.OutputStream output) |
static void |
writeUint48(long i,
byte[] buf,
int offset) |
static void |
writeUint48(long i,
java.io.OutputStream output) |
static void |
writeUint64(long i,
byte[] buf,
int offset) |
static void |
writeUint64(long i,
java.io.OutputStream output) |
static void |
writeUint8(int i,
byte[] buf,
int offset) |
static void |
writeUint8(int i,
java.io.OutputStream output) |
static void |
writeUint8(short i,
byte[] buf,
int offset) |
static void |
writeUint8(short i,
java.io.OutputStream output) |
static void |
writeUint8Array(short[] uints,
byte[] buf,
int offset) |
static void |
writeUint8Array(short[] uints,
java.io.OutputStream output) |
static void |
writeUint8ArrayWithUint8Length(short[] uints,
byte[] buf,
int offset) |
static void |
writeUint8ArrayWithUint8Length(short[] uints,
java.io.OutputStream output) |
static void |
writeVersion(ProtocolVersion version,
byte[] buf,
int offset) |
static void |
writeVersion(ProtocolVersion version,
java.io.OutputStream output) |
public static final byte[] EMPTY_BYTES
public static final short[] EMPTY_SHORTS
public static final int[] EMPTY_INTS
public static final long[] EMPTY_LONGS
public static final java.lang.String[] EMPTY_STRINGS
public static void checkUint8(short i) throws java.io.IOException
java.io.IOException
public static void checkUint8(int i) throws java.io.IOException
java.io.IOException
public static void checkUint8(long i) throws java.io.IOException
java.io.IOException
public static void checkUint16(int i) throws java.io.IOException
java.io.IOException
public static void checkUint16(long i) throws java.io.IOException
java.io.IOException
public static void checkUint24(int i) throws java.io.IOException
java.io.IOException
public static void checkUint24(long i) throws java.io.IOException
java.io.IOException
public static void checkUint32(long i) throws java.io.IOException
java.io.IOException
public static void checkUint48(long i) throws java.io.IOException
java.io.IOException
public static void checkUint64(long i) throws java.io.IOException
java.io.IOException
public static boolean isValidUint8(short i)
public static boolean isValidUint8(int i)
public static boolean isValidUint8(long i)
public static boolean isValidUint16(int i)
public static boolean isValidUint16(long i)
public static boolean isValidUint24(int i)
public static boolean isValidUint24(long i)
public static boolean isValidUint32(long i)
public static boolean isValidUint48(long i)
public static boolean isValidUint64(long i)
public static boolean isSSL(TlsContext context)
public static boolean isTLSv10(ProtocolVersion version)
public static boolean isTLSv10(TlsContext context)
public static boolean isTLSv11(ProtocolVersion version)
public static boolean isTLSv11(TlsContext context)
public static boolean isTLSv12(ProtocolVersion version)
public static boolean isTLSv12(TlsContext context)
public static boolean isTLSv13(ProtocolVersion version)
public static boolean isTLSv13(TlsContext context)
public static void writeUint8(short i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint8(int i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint8(short i, byte[] buf, int offset)
public static void writeUint8(int i, byte[] buf, int offset)
public static void writeUint16(int i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint16(int i, byte[] buf, int offset)
public static void writeUint24(int i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint24(int i, byte[] buf, int offset)
public static void writeUint32(long i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint32(long i, byte[] buf, int offset)
public static void writeUint48(long i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint48(long i, byte[] buf, int offset)
public static void writeUint64(long i, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint64(long i, byte[] buf, int offset)
public static void writeOpaque8(byte[] buf, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeOpaque8(byte[] data, byte[] buf, int off) throws java.io.IOException
java.io.IOException
public static void writeOpaque16(byte[] buf, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeOpaque16(byte[] data, byte[] buf, int off) throws java.io.IOException
java.io.IOException
public static void writeOpaque24(byte[] buf, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeOpaque24(byte[] data, byte[] buf, int off) throws java.io.IOException
java.io.IOException
public static void writeUint8Array(short[] uints, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint8Array(short[] uints, byte[] buf, int offset) throws java.io.IOException
java.io.IOException
public static void writeUint8ArrayWithUint8Length(short[] uints, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint8ArrayWithUint8Length(short[] uints, byte[] buf, int offset) throws java.io.IOException
java.io.IOException
public static void writeUint16Array(int[] uints, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint16Array(int[] uints, byte[] buf, int offset) throws java.io.IOException
java.io.IOException
public static void writeUint16ArrayWithUint8Length(int[] uints, byte[] buf, int offset) throws java.io.IOException
java.io.IOException
public static void writeUint16ArrayWithUint16Length(int[] uints, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeUint16ArrayWithUint16Length(int[] uints, byte[] buf, int offset) throws java.io.IOException
java.io.IOException
public static byte[] decodeOpaque8(byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] decodeOpaque8(byte[] buf, int minLength) throws java.io.IOException
java.io.IOException
public static byte[] decodeOpaque16(byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] decodeOpaque16(byte[] buf, int minLength) throws java.io.IOException
java.io.IOException
public static short decodeUint8(byte[] buf) throws java.io.IOException
java.io.IOException
public static short[] decodeUint8ArrayWithUint8Length(byte[] buf) throws java.io.IOException
java.io.IOException
public static int decodeUint16(byte[] buf) throws java.io.IOException
java.io.IOException
public static int[] decodeUint16ArrayWithUint8Length(byte[] buf) throws java.io.IOException
java.io.IOException
public static long decodeUint32(byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] encodeOpaque8(byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] encodeOpaque16(byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] encodeOpaque24(byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint8(short uint) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint8ArrayWithUint8Length(short[] uints) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint16(int uint) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint16ArrayWithUint8Length(int[] uints) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint16ArrayWithUint16Length(int[] uints) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint24(int uint) throws java.io.IOException
java.io.IOException
public static byte[] encodeUint32(long uint) throws java.io.IOException
java.io.IOException
public static byte[] encodeVersion(ProtocolVersion version) throws java.io.IOException
java.io.IOException
public static int readInt32(byte[] buf, int offset)
public static short readUint8(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static short readUint8(byte[] buf, int offset)
public static int readUint16(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static int readUint16(byte[] buf, int offset)
public static int readUint24(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static int readUint24(byte[] buf, int offset)
public static long readUint32(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static long readUint32(byte[] buf, int offset)
public static long readUint48(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static long readUint48(byte[] buf, int offset)
public static byte[] readAllOrNothing(int length, java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static byte[] readFully(int length, java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static void readFully(byte[] buf, java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque8(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque8(java.io.InputStream input, int minLength) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque8(java.io.InputStream input, int minLength, int maxLength) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque16(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque16(java.io.InputStream input, int minLength) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque24(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static byte[] readOpaque24(java.io.InputStream input, int minLength) throws java.io.IOException
java.io.IOException
public static short[] readUint8Array(int count, java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static short[] readUint8ArrayWithUint8Length(java.io.InputStream input, int minLength) throws java.io.IOException
java.io.IOException
public static int[] readUint16Array(int count, java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static ProtocolVersion readVersion(byte[] buf, int offset)
public static ProtocolVersion readVersion(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static org.bouncycastle.asn1.ASN1Primitive readASN1Object(byte[] encoding) throws java.io.IOException
java.io.IOException
public static org.bouncycastle.asn1.ASN1Primitive readDERObject(byte[] encoding) throws java.io.IOException
java.io.IOException
public static void requireDEREncoding(org.bouncycastle.asn1.ASN1Object asn1, byte[] encoding) throws java.io.IOException
java.io.IOException
public static void writeGMTUnixTime(byte[] buf, int offset)
public static void writeVersion(ProtocolVersion version, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static void writeVersion(ProtocolVersion version, byte[] buf, int offset)
public static void addIfSupported(java.util.Vector supportedAlgs, TlsCrypto crypto, SignatureAndHashAlgorithm alg)
public static void addIfSupported(java.util.Vector supportedGroups, TlsCrypto crypto, int namedGroup)
public static void addIfSupported(java.util.Vector supportedGroups, TlsCrypto crypto, int[] namedGroups)
public static boolean addToSet(java.util.Vector s, int i)
public static java.util.Vector getDefaultDSSSignatureAlgorithms()
public static java.util.Vector getDefaultECDSASignatureAlgorithms()
public static java.util.Vector getDefaultRSASignatureAlgorithms()
public static SignatureAndHashAlgorithm getDefaultSignatureAlgorithm(short signatureAlgorithm)
public static java.util.Vector getDefaultSignatureAlgorithms(short signatureAlgorithm)
public static java.util.Vector getDefaultSupportedSignatureAlgorithms(TlsContext context)
public static java.util.Vector getSupportedSignatureAlgorithms(TlsContext context, java.util.Vector candidates)
public static SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(TlsContext context, TlsCredentialedSigner signerCredentials) throws java.io.IOException
java.io.IOException
public static byte[] getExtensionData(java.util.Hashtable extensions, java.lang.Integer extensionType)
public static boolean hasExpectedEmptyExtensionData(java.util.Hashtable extensions, java.lang.Integer extensionType, short alertDescription) throws java.io.IOException
java.io.IOException
public static TlsSession importSession(byte[] sessionID, SessionParameters sessionParameters)
public static boolean isNullOrContainsNull(java.lang.Object[] array)
public static boolean isNullOrEmpty(byte[] array)
public static boolean isNullOrEmpty(short[] array)
public static boolean isNullOrEmpty(int[] array)
public static boolean isNullOrEmpty(java.lang.Object[] array)
public static boolean isNullOrEmpty(java.lang.String s)
public static boolean isNullOrEmpty(java.util.Vector v)
public static boolean isSignatureAlgorithmsExtensionAllowed(ProtocolVersion version)
public static short getLegacyClientCertType(short signatureAlgorithm)
public static short getLegacySignatureAlgorithmClient(short clientCertificateType)
public static short getLegacySignatureAlgorithmClientCert(short clientCertificateType)
public static short getLegacySignatureAlgorithmServer(int keyExchangeAlgorithm)
public static short getLegacySignatureAlgorithmServerCert(int keyExchangeAlgorithm)
public static java.util.Vector getLegacySupportedSignatureAlgorithms()
public static void encodeSupportedSignatureAlgorithms(java.util.Vector supportedSignatureAlgorithms, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public static java.util.Vector parseSupportedSignatureAlgorithms(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static void verifySupportedSignatureAlgorithm(java.util.Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) throws java.io.IOException
java.io.IOException
public static boolean containsSignatureAlgorithm(java.util.Vector supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm) throws java.io.IOException
java.io.IOException
public static boolean containsAnySignatureAlgorithm(java.util.Vector supportedSignatureAlgorithms, short signatureAlgorithm)
public static TlsSecret PRF(SecurityParameters securityParameters, TlsSecret secret, java.lang.String asciiLabel, byte[] seed, int length)
public static TlsSecret PRF(TlsContext context, TlsSecret secret, java.lang.String asciiLabel, byte[] seed, int length)
PRF(SecurityParameters, TlsSecret, String, byte[], int)
instead.public static byte[] clone(byte[] data)
public static java.lang.String[] clone(java.lang.String[] s)
public static boolean constantTimeAreEqual(int len, byte[] a, int aOff, byte[] b, int bOff)
public static byte[] copyOfRangeExact(byte[] original, int from, int to)
public static byte[] calculateExporterSeed(SecurityParameters securityParameters, byte[] context)
public static short getHashAlgorithmForPRFAlgorithm(int prfAlgorithm)
TlsCryptoUtils.getHashForPRF(int)
should be a useful alternative.public static org.bouncycastle.asn1.ASN1ObjectIdentifier getOIDForHashAlgorithm(short hashAlgorithm)
public static boolean hasSigningCapability(short clientCertificateType)
public static java.util.Vector vectorOfOne(java.lang.Object obj)
public static int getCipherType(int cipherSuite)
public static int getEncryptionAlgorithm(int cipherSuite)
public static int getEncryptionAlgorithmType(int encryptionAlgorithm)
public static int getKeyExchangeAlgorithm(int cipherSuite)
public static java.util.Vector getKeyExchangeAlgorithms(int[] cipherSuites)
public static int getMACAlgorithm(int cipherSuite)
public static ProtocolVersion getMinimumVersion(int cipherSuite)
public static java.util.Vector getNamedGroupRoles(int[] cipherSuites)
public static java.util.Vector getNamedGroupRoles(java.util.Vector keyExchangeAlgorithms)
public static boolean isAEADCipherSuite(int cipherSuite) throws java.io.IOException
java.io.IOException
public static boolean isBlockCipherSuite(int cipherSuite) throws java.io.IOException
java.io.IOException
public static boolean isStreamCipherSuite(int cipherSuite) throws java.io.IOException
java.io.IOException
public static boolean isValidCipherSuiteForSignatureAlgorithms(int cipherSuite, java.util.Vector sigAlgs)
public static boolean isValidCipherSuiteForVersion(int cipherSuite, ProtocolVersion version)
isValidVersionForCipherSuite(int, ProtocolVersion)
instead.public static boolean isValidSignatureSchemeForServerKeyExchange(int signatureScheme, int keyExchangeAlgorithm)
public static boolean isValidVersionForCipherSuite(int cipherSuite, ProtocolVersion version)
public static SignatureAndHashAlgorithm chooseSignatureAndHashAlgorithm(TlsContext context, java.util.Vector sigHashAlgs, short signatureAlgorithm) throws java.io.IOException
java.io.IOException
public static SignatureAndHashAlgorithm chooseSignatureAndHashAlgorithm(ProtocolVersion negotiatedVersion, java.util.Vector sigHashAlgs, short signatureAlgorithm) throws java.io.IOException
java.io.IOException
public static java.util.Vector getUsableSignatureAlgorithms(java.util.Vector sigHashAlgs)
public static int getCommonCipherSuite13(ProtocolVersion negotiatedVersion, int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder)
public static int[] getCommonCipherSuites(int[] peerCipherSuites, int[] localCipherSuites, boolean useLocalOrder)
public static int[] getSupportedCipherSuites(TlsCrypto crypto, int[] suites)
public static int[] getSupportedCipherSuites(TlsCrypto crypto, int[] suites, int suitesCount)
getSupportedCipherSuites(TlsCrypto, int[], int, int)
instead.public static int[] getSupportedCipherSuites(TlsCrypto crypto, int[] suites, int suitesOff, int suitesCount)
public static boolean isSupportedCipherSuite(TlsCrypto crypto, int cipherSuite)
public static boolean isSupportedKeyExchange(TlsCrypto crypto, int keyExchangeAlgorithm)
public static void checkPeerSigAlgs(TlsContext context, TlsCertificate[] peerCertPath) throws java.io.IOException
java.io.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.public static boolean containsNonAscii(byte[] bs)
public static boolean containsNonAscii(java.lang.String s)
public static TlsSecret generateEncryptedPreMasterSecret(TlsContext context, TlsEncryptor encryptor, java.io.OutputStream output) throws java.io.IOException
java.io.IOException