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 JcaTlsCrypto
crypto
protected javax.crypto.spec.DHParameterSpec
dhSpec
protected boolean
isPadded
-
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 JceTlsSecret
calculateDHAgreement(javax.crypto.interfaces.DHPrivateKey privateKey, javax.crypto.interfaces.DHPublicKey publicKey)
static JceTlsSecret
calculateDHAgreement(JcaTlsCrypto crypto, javax.crypto.interfaces.DHPrivateKey privateKey, javax.crypto.interfaces.DHPublicKey publicKey, boolean padded)
TlsAgreement
createDH()
Return an agreement operator suitable for ephemeral Diffie-Hellman.java.math.BigInteger
decodeParameter(byte[] encoding)
javax.crypto.interfaces.DHPublicKey
decodePublicKey(byte[] encoding)
byte[]
encodeParameter(java.math.BigInteger x)
byte[]
encodePublicKey(javax.crypto.interfaces.DHPublicKey publicKey)
java.security.KeyPair
generateKeyPair()
-
-
-
Field Detail
-
crypto
protected final JcaTlsCrypto crypto
-
dhSpec
protected final javax.crypto.spec.DHParameterSpec dhSpec
-
isPadded
protected final boolean isPadded
-
-
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:TlsDHDomain
Return an agreement operator suitable for ephemeral Diffie-Hellman.- Specified by:
createDH
in 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
-
-