public interface TlsCrypto
| Modifier and Type | Method and Description |
|---|---|
TlsSecret |
adoptSecret(TlsSecret secret)
Adopt the passed in secret, creating a new copy of it.
|
TlsCertificate |
createCertificate(byte[] encoding)
Create a TlsCertificate from an ASN.1 binary encoding of an X.509 certificate.
|
TlsCertificate |
createCertificate(short type,
byte[] encoding)
Create a TlsCertificate from a ASN.1 binary encoding of a certificate.
|
TlsCipher |
createCipher(TlsCryptoParameters cryptoParams,
int encryptionAlgorithm,
int macAlgorithm)
Create a cipher for the specified encryption and MAC algorithms.
|
TlsDHDomain |
createDHDomain(TlsDHConfig dhConfig)
Create a domain object supporting the domain parameters described in dhConfig.
|
TlsECDomain |
createECDomain(TlsECConfig ecConfig)
Create a domain object supporting the domain parameters described in ecConfig.
|
TlsHash |
createHash(int cryptoHashAlgorithm)
Create a suitable hash for the hash algorithm identifier passed in.
|
TlsHMAC |
createHMAC(int macAlgorithm)
Create a suitable HMAC for the MAC algorithm identifier passed in.
|
TlsHMAC |
createHMACForHash(int cryptoHashAlgorithm)
Create a suitable HMAC using the hash algorithm identifier passed in.
|
TlsNonceGenerator |
createNonceGenerator(byte[] additionalSeedMaterial)
Create a nonce generator.
|
TlsSecret |
createSecret(byte[] data)
Create a TlsSecret object based on provided data.
|
TlsSRP6Client |
createSRP6Client(TlsSRPConfig srpConfig)
Create an SRP-6 client.
|
TlsSRP6Server |
createSRP6Server(TlsSRPConfig srpConfig,
java.math.BigInteger srpVerifier)
Create an SRP-6 server.
|
TlsSRP6VerifierGenerator |
createSRP6VerifierGenerator(TlsSRPConfig srpConfig)
Create an SRP-6 verifier generator.
|
TlsSecret |
generateRSAPreMasterSecret(ProtocolVersion clientVersion)
Create a TlsSecret object containing a randomly-generated RSA PreMasterSecret
|
java.security.SecureRandom |
getSecureRandom()
Return the primary (safest) SecureRandom for this crypto.
|
boolean |
hasAnyStreamVerifiers(java.util.Vector signatureAndHashAlgorithms)
Return true if this TlsCrypto would use a stream verifier for any of the passed in algorithms.
|
boolean |
hasAnyStreamVerifiersLegacy(short[] clientCertificateTypes)
Return true if this TlsCrypto would use a stream verifier for any of the passed in algorithms.
|
boolean |
hasCryptoHashAlgorithm(int cryptoHashAlgorithm)
Return true if this TlsCrypto can support the passed in hash algorithm.
|
boolean |
hasCryptoSignatureAlgorithm(int cryptoSignatureAlgorithm)
Return true if this TlsCrypto can support the passed in signature algorithm
(not necessarily in combination with EVERY hash algorithm).
|
boolean |
hasDHAgreement()
Return true if this TlsCrypto can support DH key agreement.
|
boolean |
hasECDHAgreement()
Return true if this TlsCrypto can support ECDH key agreement.
|
boolean |
hasEncryptionAlgorithm(int encryptionAlgorithm)
Return true if this TlsCrypto can support the passed in block/stream encryption algorithm.
|
boolean |
hasHKDFAlgorithm(int cryptoHashAlgorithm)
Return true if this TlsCrypto can support HKDF with the passed in hash algorithm.
|
boolean |
hasMacAlgorithm(int macAlgorithm)
Return true if this TlsCrypto can support the passed in MAC algorithm.
|
boolean |
hasNamedGroup(int namedGroup)
Return true if this TlsCrypto supports the passed in
named group value. |
boolean |
hasRSAEncryption()
Return true if this TlsCrypto can support RSA encryption/decryption.
|
boolean |
hasSignatureAlgorithm(short signatureAlgorithm)
Return true if this TlsCrypto can support the passed in signature algorithm
(not necessarily in combination with EVERY hash algorithm).
|
boolean |
hasSignatureAndHashAlgorithm(SignatureAndHashAlgorithm sigAndHashAlgorithm)
Return true if this TlsCrypto can support the passed in signature algorithm.
|
boolean |
hasSignatureScheme(int signatureScheme)
Return true if this TlsCrypto can support the passed in signature scheme.
|
boolean |
hasSRPAuthentication()
Return true if this TlsCrypto can support SRP authentication.
|
TlsSecret |
hkdfInit(int cryptoHashAlgorithm)
Setup an initial "secret" for a chain of HKDF calls (RFC 5869), containing a string of HashLen zeroes.
|
boolean hasAnyStreamVerifiers(java.util.Vector signatureAndHashAlgorithms)
signatureAndHashAlgorithms - A Vector of SignatureAndHashAlgorithm values.boolean hasAnyStreamVerifiersLegacy(short[] clientCertificateTypes)
clientCertificateTypes - An array of ClientCertificateType values.boolean hasCryptoHashAlgorithm(int cryptoHashAlgorithm)
cryptoHashAlgorithm - the algorithm of interest.boolean hasCryptoSignatureAlgorithm(int cryptoSignatureAlgorithm)
cryptoSignatureAlgorithm - the algorithm of interest.boolean hasDHAgreement()
boolean hasECDHAgreement()
boolean hasEncryptionAlgorithm(int encryptionAlgorithm)
encryptionAlgorithm - the algorithm of interest.boolean hasHKDFAlgorithm(int cryptoHashAlgorithm)
cryptoHashAlgorithm - the algorithm of interest.boolean hasMacAlgorithm(int macAlgorithm)
macAlgorithm - the algorithm of interest.boolean hasNamedGroup(int namedGroup)
named group value.named group value.boolean hasRSAEncryption()
boolean hasSignatureAlgorithm(short signatureAlgorithm)
signatureAlgorithm - the algorithm of interest.boolean hasSignatureAndHashAlgorithm(SignatureAndHashAlgorithm sigAndHashAlgorithm)
sigAndHashAlgorithm - the algorithm of interest.boolean hasSignatureScheme(int signatureScheme)
signatureScheme - the scheme of interest.boolean hasSRPAuthentication()
TlsSecret createSecret(byte[] data)
data - the data to base the TlsSecret on.TlsSecret generateRSAPreMasterSecret(ProtocolVersion clientVersion)
clientVersion - the client version to place in the first 2 bytesjava.security.SecureRandom getSecureRandom()
TlsCertificate createCertificate(byte[] encoding) throws java.io.IOException
encoding - DER/BER encoding of the certificate of interest.java.io.IOException - if there is an issue on decoding or constructing the certificate.TlsCertificate createCertificate(short type, byte[] encoding) throws java.io.IOException
type - Certificate type as per IANA TLS Certificate Types registryencoding - DER/BER encoding of the certificate of interest.java.io.IOException - if there is an issue on decoding or constructing the certificate.TlsCipher createCipher(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int macAlgorithm) throws java.io.IOException
See enumeration classes EncryptionAlgorithm, MACAlgorithm for appropriate argument values.
cryptoParams - context specific parameters.encryptionAlgorithm - the encryption algorithm to be employed by the cipher.macAlgorithm - the MAC algorithm to be employed by the cipher.TlsCipher implementing the encryption and MAC algorithms.java.io.IOExceptionTlsDHDomain createDHDomain(TlsDHConfig dhConfig)
dhConfig - the config describing the DH parameters to use.TlsECDomain createECDomain(TlsECConfig ecConfig)
ecConfig - the config describing the EC parameters to use.TlsSecret adoptSecret(TlsSecret secret)
secret - the secret to make a copy of.TlsHash createHash(int cryptoHashAlgorithm)
See enumeration class CryptoHashAlgorithm for appropriate argument values.
cryptoHashAlgorithm - the hash algorithm the hash needs to implement.TlsHash.TlsHMAC createHMAC(int macAlgorithm)
See enumeration class MACAlgorithm for appropriate argument values.
macAlgorithm - the MAC algorithm the HMAC needs to match.TlsHMAC.TlsHMAC createHMACForHash(int cryptoHashAlgorithm)
See enumeration class CryptoHashAlgorithm for appropriate argument values.
cryptoHashAlgorithm - the hash algorithm the HMAC should use.TlsHMAC.TlsNonceGenerator createNonceGenerator(byte[] additionalSeedMaterial)
TlsCrypto's entropy source, and from the provided additional seed material. The
output of each returned generator must be completely independent of the others.additionalSeedMaterial - context-specific seed materialTlsNonceGeneratorTlsSRP6Client createSRP6Client(TlsSRPConfig srpConfig)
srpConfig - client config.TlsSRP6Server createSRP6Server(TlsSRPConfig srpConfig, java.math.BigInteger srpVerifier)
srpConfig - server config.srpVerifier - the SRP6 verifier value.TlsSRP6VerifierGenerator createSRP6VerifierGenerator(TlsSRPConfig srpConfig)
srpConfig - generator config.TlsSecret hkdfInit(int cryptoHashAlgorithm)
cryptoHashAlgorithm - the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.