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 a ASN.1 binary encoding of an X.509 certificate.
|
TlsDHDomain |
createDHDomain(TlsDHConfig dhConfig)
Create an domain object supporting the domain parameters described in dhConfig.
|
TlsECDomain |
createECDomain(TlsECConfig ecConfig)
Create an domain object supporting the domain parameters described in ecConfig.
|
TlsHash |
createHash(short algorithm)
Create a suitable hash for the hash algorithm identifier passed in.
|
TlsHash |
createHash(SignatureAndHashAlgorithm sidAlgorithm)
Create a suitable hash for the signature algorithm identifier passed in.
|
TlsHMAC |
createHMAC(int macAlgorithm)
Create a suitable HMAC for the MAC algorithm identifier passed in.
|
byte[] |
createNonce(int size)
Create a nonce byte[] string.
|
TlsSecret |
createSecret(byte[] data)
Create a TlsSecret object based 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 |
hasAllRawSignatureAlgorithms()
Return true if this TlsCrypto can perform raw signatures and verifications for all supported algorithms.
|
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 |
hasHashAlgorithm(short hashAlgorithm)
Return true if this TlsCrypto can support the passed in hash algorithm.
|
boolean |
hasMacAlgorithm(int macAlgorithm)
Return true if this TlsCrypto can support the passed in MAC algorithm.
|
boolean |
hasNamedCurve(int curveID)
Return true if this TlsCrypto supports the passed in curveID.
|
boolean |
hasRSAEncryption()
Return true if this TlsCrypto can support RSA encryption/decryption.
|
boolean |
hasSignatureAlgorithm(int 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 |
hasSRPAuthentication()
Return true if this TlsCrypto can support SRP authentication.
|
boolean hasAllRawSignatureAlgorithms()
boolean hasDHAgreement()
boolean hasECDHAgreement()
boolean hasEncryptionAlgorithm(int encryptionAlgorithm)
encryptionAlgorithm
- the algorithm of interest.boolean hasHashAlgorithm(short hashAlgorithm)
hashAlgorithm
- the algorithm of interest.boolean hasMacAlgorithm(int macAlgorithm)
macAlgorithm
- the algorithm of interest.boolean hasNamedCurve(int curveID)
boolean hasRSAEncryption()
boolean hasSignatureAlgorithm(int signatureAlgorithm)
signatureAlgorithm
- the algorithm of interest.boolean hasSignatureAndHashAlgorithm(SignatureAndHashAlgorithm sigAndHashAlgorithm)
sigAndHashAlgorithm
- the algorithm 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.TlsDHDomain 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(SignatureAndHashAlgorithm sidAlgorithm)
sidAlgorithm
- the signature algorithm the hash needs to match.TlsHash createHash(short algorithm)
algorithm
- the hash algorithm the hash needs to implement.TlsHMAC createHMAC(int macAlgorithm) throws java.io.IOException
See enumeration class MACAlgorithm
for appropriate argument values.
macAlgorithm
- the MAC algorithm the HMAC needs to match.java.io.IOException
byte[] createNonce(int size)
size
- the length, in bytes, of the nonce to generate.TlsSRP6Client 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.