Class JceTlsDHDomain
- java.lang.Object
-
- org.bouncycastle.tls.crypto.impl.jcajce.JceTlsDHDomain
-
- All Implemented Interfaces:
TlsDHDomain
public class JceTlsDHDomain extends java.lang.Object implements TlsDHDomain
JCE support class for Diffie-Hellman key pair generation and key agreement over a specified Diffie-Hellman configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected JcaTlsCryptocryptoprotected TlsDHConfigdhConfigprotected javax.crypto.spec.DHParameterSpecdhSpec
-
Constructor Summary
Constructors Constructor Description JceTlsDHDomain(JcaTlsCrypto crypto, TlsDHConfig dhConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JceTlsSecretcalculateDHAgreement(javax.crypto.interfaces.DHPrivateKey privateKey, javax.crypto.interfaces.DHPublicKey publicKey)static JceTlsSecretcalculateDHAgreement(JcaTlsCrypto crypto, javax.crypto.interfaces.DHPrivateKey privateKey, javax.crypto.interfaces.DHPublicKey publicKey, boolean padded)TlsAgreementcreateDH()Return an agreement operator suitable for ephemeral Diffie-Hellman.java.math.BigIntegerdecodeParameter(byte[] encoding)javax.crypto.interfaces.DHPublicKeydecodePublicKey(byte[] encoding)byte[]encodeParameter(java.math.BigInteger x)byte[]encodePublicKey(javax.crypto.interfaces.DHPublicKey publicKey)java.security.KeyPairgenerateKeyPair()
-
-
-
Field Detail
-
crypto
protected final JcaTlsCrypto crypto
-
dhConfig
protected final TlsDHConfig dhConfig
-
dhSpec
protected final javax.crypto.spec.DHParameterSpec dhSpec
-
-
Constructor Detail
-
JceTlsDHDomain
public JceTlsDHDomain(JcaTlsCrypto crypto, TlsDHConfig dhConfig)
-
-
Method Detail
-
calculateDHAgreement
public static JceTlsSecret calculateDHAgreement(JcaTlsCrypto crypto, javax.crypto.interfaces.DHPrivateKey privateKey, javax.crypto.interfaces.DHPublicKey publicKey, boolean padded) throws java.io.IOException
- Throws:
java.io.IOException
-
calculateDHAgreement
public JceTlsSecret calculateDHAgreement(javax.crypto.interfaces.DHPrivateKey privateKey, javax.crypto.interfaces.DHPublicKey publicKey) throws java.io.IOException
- Throws:
java.io.IOException
-
createDH
public TlsAgreement createDH()
Description copied from interface:TlsDHDomainReturn an agreement operator suitable for ephemeral Diffie-Hellman.- Specified by:
createDHin interfaceTlsDHDomain- Returns:
- a key agreement operator.
-
decodeParameter
public java.math.BigInteger decodeParameter(byte[] encoding) throws java.io.IOException- Throws:
java.io.IOException
-
decodePublicKey
public javax.crypto.interfaces.DHPublicKey decodePublicKey(byte[] encoding) throws java.io.IOException- Throws:
java.io.IOException
-
encodeParameter
public byte[] encodeParameter(java.math.BigInteger x) throws java.io.IOException- Throws:
java.io.IOException
-
encodePublicKey
public byte[] encodePublicKey(javax.crypto.interfaces.DHPublicKey publicKey) throws java.io.IOException- Throws:
java.io.IOException
-
generateKeyPair
public java.security.KeyPair generateKeyPair() throws java.io.IOException- Throws:
java.io.IOException
-
-