Package org.bouncycastle.tls.crypto.impl
Class AbstractTlsCrypto
- java.lang.Object
-
- org.bouncycastle.tls.crypto.impl.AbstractTlsCrypto
-
- All Implemented Interfaces:
TlsCrypto
- Direct Known Subclasses:
BcTlsCrypto
,JcaTlsCrypto
public abstract class AbstractTlsCrypto extends java.lang.Object implements TlsCrypto
Base class for a TlsCrypto implementation that provides some needed methods from elsewhere in the impl package.
-
-
Constructor Summary
Constructors Constructor Description AbstractTlsCrypto()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TlsSecret
adoptSecret(TlsSecret secret)
Adopt the passed in secret, creating a new copy of it..protected abstract TlsCipher
createCipher(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int macAlgorithm)
Create a cipher for the specified encryption and MAC algorithms.protected abstract TlsEncryptor
createEncryptor(TlsCertificate certificate)
Return an encryptor based on the public key in certificate.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bouncycastle.tls.crypto.TlsCrypto
createCertificate, createDHDomain, createECDomain, createHash, createHMAC, createHMAC, createNonceGenerator, createSecret, createSRP6Client, createSRP6Server, createSRP6VerifierGenerator, generateRSAPreMasterSecret, getSecureRandom, hasAllRawSignatureAlgorithms, hasDHAgreement, hasECDHAgreement, hasEncryptionAlgorithm, hasHashAlgorithm, hasMacAlgorithm, hasNamedGroup, hasRSAEncryption, hasSignatureAlgorithm, hasSignatureAndHashAlgorithm, hasSignatureScheme, hasSRPAuthentication, hkdfInit
-
-
-
-
Method Detail
-
adoptSecret
public TlsSecret adoptSecret(TlsSecret secret)
Adopt the passed in secret, creating a new copy of it..- Specified by:
adoptSecret
in interfaceTlsCrypto
- Parameters:
secret
- the secret to make a copy of.- Returns:
- a TlsSecret based the original secret.
-
createCipher
protected abstract TlsCipher createCipher(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int macAlgorithm) throws java.io.IOException
Create a cipher for the specified encryption and MAC algorithms.See enumeration classes
EncryptionAlgorithm
,MACAlgorithm
for appropriate argument values.- Parameters:
cryptoParams
- context specific parameters.encryptionAlgorithm
- the encryption algorithm to be employed by the cipher.macAlgorithm
- the MAC algorithm to be employed by the cipher.- Returns:
- a
TlsCipher
implementing the encryption and MAC algorithm. - Throws:
java.io.IOException
-
createEncryptor
protected abstract TlsEncryptor createEncryptor(TlsCertificate certificate) throws java.io.IOException
Return an encryptor based on the public key in certificate.- Parameters:
certificate
- the certificate carrying the public key.- Returns:
- a TlsEncryptor based on the certificate's public key.
- Throws:
java.io.IOException
-
-