This class provides default implementations for everything. If you need to customise it, extend the class and override the appropriate methods.
| Modifier and Type | Field and Description |
|---|---|
| private final SecureRandom |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv BcTlsSecret | |
| public Digest | |
| protected AEADBlockCipher | |
| protected AEADBlockCipher | |
| protected AEADBlockCipher | |
| protected AEADBlockCipher | |
| protected AEADBlockCipher | |
| protected AEADBlockCipher | |
| protected BlockCipher | |
| protected BlockCipher | |
| protected BlockCipher | |
| protected BlockCipher | |
| protected BlockCipher | |
| protected BlockCipher | |
| protected AEADBlockCipher | |
| public TlsCertificate | createCertificate(byte[]
DER/BER encoding of the certificate of interest. encoding)Implements org. Create a TlsCertificate from an ASN.1 binary encoding of an X.509 certificate. |
| public TlsCertificate | createCertificate(short
Certificate type as per IANA TLS Certificate Types registry type, byte[] DER/BER encoding of the certificate of interest. encoding)Implements org. Create a TlsCertificate from a ASN.1 binary encoding of a certificate. |
| protected TlsCipher | |
| public TlsCipher | createCipher(TlsCryptoParameters
context specific parameters. cryptoParams, int the encryption algorithm to be employed by the cipher. encryptionAlgorithm, int the MAC algorithm to be employed by the cipher. macAlgorithm)Implements org. Create a cipher for the specified encryption and MAC algorithms. |
| protected TlsAEADCipher | |
| protected TlsAEADCipher | |
| protected TlsAEADCipher | |
| protected TlsAEADCipher | |
| protected TlsCipher | createCipher_CBC(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int cipherKeySize, int macAlgorithm)
|
| protected TlsAEADCipher | |
| protected TlsAEADCipher | |
| protected BlockCipher | |
| public TlsDHDomain | createDHDomain(TlsDHConfig
the config describing the DH parameters to use. dhConfig)Implements org. Create a domain object supporting the domain parameters described in dhConfig. |
| public Digest | |
| public TlsECDomain | createECDomain(TlsECConfig
the config describing the EC parameters to use. ecConfig)Implements org. Create a domain object supporting the domain parameters described in ecConfig. |
| protected AEADBlockCipher | |
| public TlsHash | createHash(int
the hash algorithm the hash needs to implement. cryptoHashAlgorithm)Implements org. Create a suitable hash for the hash algorithm identifier passed in.
See enumeration class |
| public TlsHMAC | createHMAC(int
the MAC algorithm the HMAC needs to match. macAlgorithm)Implements org. Create a suitable HMAC for the MAC algorithm identifier passed in.
See enumeration class |
| protected TlsHMAC | |
| public TlsHMAC | createHMACForHash(int
the hash algorithm the HMAC should use. cryptoHashAlgorithm)Implements org. Create a suitable HMAC using the hash algorithm identifier passed in.
See enumeration class |
| public TlsKemDomain | createKemDomain(TlsKemConfig
the config describing the KEM parameters to use. kemConfig)Implements org. Create a domain object supporting the domain parameters described in kemConfig. |
| protected TlsHMAC | |
| public TlsNonceGenerator | createNonceGenerator(byte[]
context-specific seed material additionalSeedMaterial)Implements org. Create a nonce generator. |
| protected TlsNullCipher | |
| public TlsSecret | createSecret(byte[]
the data to base the TlsSecret on. data)Implements org. Create a TlsSecret object based on provided data. |
| protected BlockCipher | |
| protected BlockCipher | |
| public TlsSRP6Client | createSRP6Client(TlsSRPConfig
client config. srpConfig)Implements org. Create an SRP-6 client. |
| public TlsSRP6Server | createSRP6Server(TlsSRPConfig
server config. srpConfig, BigInteger the SRP6 verifier value. srpVerifier)Implements org. Create an SRP-6 server. |
| public TlsSRP6VerifierGenerator | createSRP6VerifierGenerator(TlsSRPConfig
generator config. srpConfig)Implements org. Create an SRP-6 verifier generator. |
| public TlsSecret | generateRSAPreMasterSecret(ProtocolVersion
the client version to place in the first 2 bytes version)Implements org. Create a TlsSecret object containing a randomly-generated RSA PreMasterSecret |
| public SecureRandom | getSecureRandom()
Implements org. Return the primary (safest) SecureRandom for this crypto. |
| public boolean | hasAnyStreamVerifiers(Vector<E>
A signatureAndHashAlgorithms)Vector of SignatureAndHashAlgorithm values.Implements org. Return true if this TlsCrypto would use a stream verifier for any of the passed in algorithms. |
| public boolean | hasAnyStreamVerifiersLegacy(short[]
An array of clientCertificateTypes)ClientCertificateType values.Implements org. Return true if this TlsCrypto would use a stream verifier for any of the passed in algorithms. |
| public boolean | hasCryptoHashAlgorithm(int
the algorithm of interest. cryptoHashAlgorithm)Implements org. Return true if this TlsCrypto can support the passed in hash algorithm. |
| public boolean | hasCryptoSignatureAlgorithm(int
the algorithm of interest. cryptoSignatureAlgorithm)Implements org. Return true if this TlsCrypto can support the passed in signature algorithm (not necessarily in combination with EVERY hash algorithm). |
| public boolean | hasDHAgreement()
Implements org. Return true if this TlsCrypto can support DH key agreement. |
| public boolean | hasECDHAgreement()
Implements org. Return true if this TlsCrypto can support ECDH key agreement. |
| public boolean | hasEncryptionAlgorithm(int
the algorithm of interest. encryptionAlgorithm)Implements org. Return true if this TlsCrypto can support the passed in block/stream encryption algorithm. |
| public boolean | hasHKDFAlgorithm(int
the algorithm of interest. cryptoHashAlgorithm)Implements org. Return true if this TlsCrypto can support HKDF with the passed in hash algorithm. |
| public boolean | hasKemAgreement()
Implements org. Return true if this TlsCrypto can support KEM key agreement. |
| public boolean | hasMacAlgorithm(int
the algorithm of interest. macAlgorithm)Implements org. Return true if this TlsCrypto can support the passed in MAC algorithm. |
| public boolean | hasNamedGroup(int namedGroup)
Implements org. Return true if this TlsCrypto supports the passed in |
| public boolean | hasRSAEncryption()
Implements org. Return true if this TlsCrypto can support RSA encryption/decryption. |
| public boolean | hasSignatureAlgorithm(short
the algorithm of interest. signatureAlgorithm)Implements org. Return true if this TlsCrypto can support the passed in signature algorithm (not necessarily in combination with EVERY hash algorithm). |
| public boolean | hasSignatureAndHashAlgorithm(SignatureAndHashAlgorithm
the algorithm of interest. sigAndHashAlgorithm)Implements org. Return true if this TlsCrypto can support the passed in signature algorithm. |
| public boolean | hasSignatureScheme(int
the scheme of interest. signatureScheme)Implements org. Return true if this TlsCrypto can support the passed in signature scheme. |
| public boolean | hasSRPAuthentication()
Implements org. Return true if this TlsCrypto can support SRP authentication. |
| public TlsSecret | hkdfInit(int
the hash algorithm to instantiate HMAC with. See cryptoHashAlgorithm)CryptoHashAlgorithm for values.Implements org. Setup an initial "secret" for a chain of HKDF calls (RFC 5869), containing a string of HashLen zeroes. |
| entropySource | back to summary |
|---|---|
| private final SecureRandom entropySource | |
| BcTlsCrypto | back to summary |
|---|---|
| public BcTlsCrypto() | |
| BcTlsCrypto | back to summary |
|---|---|
| public BcTlsCrypto(SecureRandom entropySource) | |
| adoptLocalSecret | back to summary |
|---|---|
| pack-priv BcTlsSecret adoptLocalSecret(byte[] data) | |
| cloneDigest | back to summary |
|---|---|
| public Digest cloneDigest(int cryptoHashAlgorithm, Digest digest) | |
| createAEADBlockCipher_AES_CCM | back to summary |
|---|---|
| protected AEADBlockCipher createAEADBlockCipher_AES_CCM() | |
| createAEADBlockCipher_AES_GCM | back to summary |
|---|---|
| protected AEADBlockCipher createAEADBlockCipher_AES_GCM() | |
| createAEADBlockCipher_ARIA_GCM | back to summary |
|---|---|
| protected AEADBlockCipher createAEADBlockCipher_ARIA_GCM() | |
| createAEADBlockCipher_Camellia_GCM | back to summary |
|---|---|
| protected AEADBlockCipher createAEADBlockCipher_Camellia_GCM() | |
| createAEADBlockCipher_SM4_CCM | back to summary |
|---|---|
| protected AEADBlockCipher createAEADBlockCipher_SM4_CCM() | |
| createAEADBlockCipher_SM4_GCM | back to summary |
|---|---|
| protected AEADBlockCipher createAEADBlockCipher_SM4_GCM() | |
| createAESEngine | back to summary |
|---|---|
| protected BlockCipher createAESEngine() | |
| createARIAEngine | back to summary |
|---|---|
| protected BlockCipher createARIAEngine() | |
| createBlockCipher | back to summary |
|---|---|
| protected BlockCipher createBlockCipher(int encryptionAlgorithm) throws IOException | |
| createCamelliaEngine | back to summary |
|---|---|
| protected BlockCipher createCamelliaEngine() | |
| createCBCBlockCipher | back to summary |
|---|---|
| protected BlockCipher createCBCBlockCipher(BlockCipher blockCipher) | |
| createCBCBlockCipher | back to summary |
|---|---|
| protected BlockCipher createCBCBlockCipher(int encryptionAlgorithm) throws IOException | |
| createCCMMode | back to summary |
|---|---|
| protected AEADBlockCipher createCCMMode(BlockCipher engine) | |
| createCertificate | back to summary |
|---|---|
| public TlsCertificate createCertificate(byte[] encoding) throws IOException Implements org. Doc from org. Create a TlsCertificate from an ASN.1 binary encoding of an X.509 certificate.
| |
| createCertificate | back to summary |
|---|---|
| public TlsCertificate createCertificate(short type, byte[] encoding) throws IOException Implements org. Doc from org. Create a TlsCertificate from a ASN.1 binary encoding of a certificate.
| |
| createChaCha20Poly1305 | back to summary |
|---|---|
| protected TlsCipher createChaCha20Poly1305(TlsCryptoParameters cryptoParams) throws IOException | |
| createCipher | back to summary |
|---|---|
| public TlsCipher createCipher(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int macAlgorithm) throws IOException Implements org. Doc from org. Create a cipher for the specified encryption and MAC algorithms.
See enumeration classes
| |
| createCipher_AES_CCM | back to summary |
|---|---|
| protected TlsAEADCipher createCipher_AES_CCM(TlsCryptoParameters cryptoParams, int cipherKeySize, int macSize) throws IOException | |
| createCipher_AES_GCM | back to summary |
|---|---|
| protected TlsAEADCipher createCipher_AES_GCM(TlsCryptoParameters cryptoParams, int cipherKeySize, int macSize) throws IOException | |
| createCipher_ARIA_GCM | back to summary |
|---|---|
| protected TlsAEADCipher createCipher_ARIA_GCM(TlsCryptoParameters cryptoParams, int cipherKeySize, int macSize) throws IOException | |
| createCipher_Camellia_GCM | back to summary |
|---|---|
| protected TlsAEADCipher createCipher_Camellia_GCM(TlsCryptoParameters cryptoParams, int cipherKeySize, int macSize) throws IOException | |
| createCipher_CBC | back to summary |
|---|---|
| protected TlsCipher createCipher_CBC(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int cipherKeySize, int macAlgorithm) throws IOException | |
| createCipher_SM4_CCM | back to summary |
|---|---|
| protected TlsAEADCipher createCipher_SM4_CCM(TlsCryptoParameters cryptoParams) throws IOException | |
| createCipher_SM4_GCM | back to summary |
|---|---|
| protected TlsAEADCipher createCipher_SM4_GCM(TlsCryptoParameters cryptoParams) throws IOException | |
| createDESedeEngine | back to summary |
|---|---|
| protected BlockCipher createDESedeEngine() | |
| createDHDomain | back to summary |
|---|---|
| public TlsDHDomain createDHDomain(TlsDHConfig dhConfig) Implements org. Doc from org. Create a domain object supporting the domain parameters described in dhConfig.
| |
| createDigest | back to summary |
|---|---|
| public Digest createDigest(int cryptoHashAlgorithm) | |
| createECDomain | back to summary |
|---|---|
| public TlsECDomain createECDomain(TlsECConfig ecConfig) Implements org. Doc from org. Create a domain object supporting the domain parameters described in ecConfig.
| |
| createGCMMode | back to summary |
|---|---|
| protected AEADBlockCipher createGCMMode(BlockCipher engine) | |
| createHash | back to summary |
|---|---|
| public TlsHash createHash(int cryptoHashAlgorithm) Implements org. Doc from org. Create a suitable hash for the hash algorithm identifier passed in.
See enumeration class | |
| createHMAC | back to summary |
|---|---|
| public TlsHMAC createHMAC(int macAlgorithm) Implements org. Doc from org. Create a suitable HMAC for the MAC algorithm identifier passed in.
See enumeration class | |
| createHMAC_SSL | back to summary |
|---|---|
| protected TlsHMAC createHMAC_SSL(int macAlgorithm) throws IOException | |
| createHMACForHash | back to summary |
|---|---|
| public TlsHMAC createHMACForHash(int cryptoHashAlgorithm) Implements org. Doc from org. Create a suitable HMAC using the hash algorithm identifier passed in.
See enumeration class | |
| createKemDomain | back to summary |
|---|---|
| public TlsKemDomain createKemDomain(TlsKemConfig kemConfig) Implements org. Doc from org. Create a domain object supporting the domain parameters described in kemConfig.
| |
| createMAC | back to summary |
|---|---|
| protected TlsHMAC createMAC(TlsCryptoParameters cryptoParams, int macAlgorithm) throws IOException | |
| createNonceGenerator | back to summary |
|---|---|
| public TlsNonceGenerator createNonceGenerator(byte[] additionalSeedMaterial) Implements org. Doc from org. Create a nonce generator. Each call should construct a new generator, and the generator
should be returned from this call only after automatically seeding from this
| |
| createNullCipher | back to summary |
|---|---|
| protected TlsNullCipher createNullCipher(TlsCryptoParameters cryptoParams, int macAlgorithm) throws IOException | |
| createSecret | back to summary |
|---|---|
| public TlsSecret createSecret(byte[] data) Implements org. Doc from org. Create a TlsSecret object based on provided data.
| |
| createSEEDEngine | back to summary |
|---|---|
| protected BlockCipher createSEEDEngine() | |
| createSM4Engine | back to summary |
|---|---|
| protected BlockCipher createSM4Engine() | |
| createSRP6Client | back to summary |
|---|---|
| public TlsSRP6Client createSRP6Client(TlsSRPConfig srpConfig) Implements org. Doc from org. Create an SRP-6 client.
| |
| createSRP6Server | back to summary |
|---|---|
| public TlsSRP6Server createSRP6Server(TlsSRPConfig srpConfig, BigInteger srpVerifier) Implements org. Doc from org. Create an SRP-6 server.
| |
| createSRP6VerifierGenerator | back to summary |
|---|---|
| public TlsSRP6VerifierGenerator createSRP6VerifierGenerator(TlsSRPConfig srpConfig) Implements org. Doc from org. Create an SRP-6 verifier generator.
| |
| generateRSAPreMasterSecret | back to summary |
|---|---|
| public TlsSecret generateRSAPreMasterSecret(ProtocolVersion version) Implements org. Doc from org. Create a TlsSecret object containing a randomly-generated RSA PreMasterSecret
| |
| getSecureRandom | back to summary |
|---|---|
| public SecureRandom getSecureRandom() Implements org. Doc from org. Return the primary (safest) SecureRandom for this crypto.
| |
| hasAnyStreamVerifiers | back to summary |
|---|---|
| public boolean hasAnyStreamVerifiers(Vector<E> signatureAndHashAlgorithms) Implements org. Doc from org. Return true if this TlsCrypto would use a stream verifier for any of the passed in algorithms. This method is only relevant to handshakes negotiating (D)TLS 1.2.
| |
| hasAnyStreamVerifiersLegacy | back to summary |
|---|---|
| public boolean hasAnyStreamVerifiersLegacy(short[] clientCertificateTypes) Implements org. Doc from org. Return true if this TlsCrypto would use a stream verifier for any of the passed in algorithms. This method is only relevant to handshakes negotiating (D)TLS versions older than 1.2.
| |
| hasCryptoHashAlgorithm | back to summary |
|---|---|
| public boolean hasCryptoHashAlgorithm(int cryptoHashAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in hash algorithm.
| |
| hasCryptoSignatureAlgorithm | back to summary |
|---|---|
| public boolean hasCryptoSignatureAlgorithm(int cryptoSignatureAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in signature algorithm (not necessarily in combination with EVERY hash algorithm).
| |
| hasDHAgreement | back to summary |
|---|---|
| public boolean hasDHAgreement() Implements org. Doc from org. Return true if this TlsCrypto can support DH key agreement.
| |
| hasECDHAgreement | back to summary |
|---|---|
| public boolean hasECDHAgreement() Implements org. Doc from org. Return true if this TlsCrypto can support ECDH key agreement.
| |
| hasEncryptionAlgorithm | back to summary |
|---|---|
| public boolean hasEncryptionAlgorithm(int encryptionAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in block/stream encryption algorithm.
| |
| hasHKDFAlgorithm | back to summary |
|---|---|
| public boolean hasHKDFAlgorithm(int cryptoHashAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support HKDF with the passed in hash algorithm.
| |
| hasKemAgreement | back to summary |
|---|---|
| public boolean hasKemAgreement() Implements org. Doc from org. Return true if this TlsCrypto can support KEM key agreement.
| |
| hasMacAlgorithm | back to summary |
|---|---|
| public boolean hasMacAlgorithm(int macAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in MAC algorithm.
| |
| hasNamedGroup | back to summary |
|---|---|
| public boolean hasNamedGroup(int namedGroup) Implements org. Doc from org. Return true if this TlsCrypto supports the passed in
| |
| hasRSAEncryption | back to summary |
|---|---|
| public boolean hasRSAEncryption() Implements org. Doc from org. Return true if this TlsCrypto can support RSA encryption/decryption.
| |
| hasSignatureAlgorithm | back to summary |
|---|---|
| public boolean hasSignatureAlgorithm(short signatureAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in signature algorithm (not necessarily in combination with EVERY hash algorithm).
| |
| hasSignatureAndHashAlgorithm | back to summary |
|---|---|
| public boolean hasSignatureAndHashAlgorithm(SignatureAndHashAlgorithm sigAndHashAlgorithm) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in signature algorithm.
| |
| hasSignatureScheme | back to summary |
|---|---|
| public boolean hasSignatureScheme(int signatureScheme) Implements org. Doc from org. Return true if this TlsCrypto can support the passed in signature scheme.
| |
| hasSRPAuthentication | back to summary |
|---|---|
| public boolean hasSRPAuthentication() Implements org. Doc from org. Return true if this TlsCrypto can support SRP authentication.
| |
| hkdfInit | back to summary |
|---|---|
| public TlsSecret hkdfInit(int cryptoHashAlgorithm) Implements org. Doc from org. Setup an initial "secret" for a chain of HKDF calls (RFC 5869), containing a string of HashLen zeroes.
| |