Class BcTlsDHDomain
- java.lang.Object
-
- org.bouncycastle.tls.crypto.impl.bc.BcTlsDHDomain
-
- All Implemented Interfaces:
TlsDHDomain
public class BcTlsDHDomain extends java.lang.Object implements TlsDHDomain
BC light-weight 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 TlsDHConfig
config
protected BcTlsCrypto
crypto
protected org.bouncycastle.crypto.params.DHParameters
domainParameters
-
Constructor Summary
Constructors Constructor Description BcTlsDHDomain(BcTlsCrypto crypto, TlsDHConfig dhConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BcTlsSecret
calculateDHAgreement(org.bouncycastle.crypto.params.DHPrivateKeyParameters privateKey, org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey)
static BcTlsSecret
calculateDHAgreement(BcTlsCrypto crypto, org.bouncycastle.crypto.params.DHPrivateKeyParameters privateKey, org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey, boolean padded)
TlsAgreement
createDH()
Return an agreement operator suitable for ephemeral Diffie-Hellman.java.math.BigInteger
decodeParameter(byte[] encoding)
org.bouncycastle.crypto.params.DHPublicKeyParameters
decodePublicKey(byte[] encoding)
byte[]
encodeParameter(java.math.BigInteger x)
byte[]
encodePublicKey(org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey)
org.bouncycastle.crypto.AsymmetricCipherKeyPair
generateKeyPair()
static org.bouncycastle.crypto.params.DHParameters
getDomainParameters(TlsDHConfig dhConfig)
-
-
-
Field Detail
-
crypto
protected BcTlsCrypto crypto
-
config
protected TlsDHConfig config
-
domainParameters
protected org.bouncycastle.crypto.params.DHParameters domainParameters
-
-
Constructor Detail
-
BcTlsDHDomain
public BcTlsDHDomain(BcTlsCrypto crypto, TlsDHConfig dhConfig)
-
-
Method Detail
-
calculateDHAgreement
public static BcTlsSecret calculateDHAgreement(BcTlsCrypto crypto, org.bouncycastle.crypto.params.DHPrivateKeyParameters privateKey, org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey, boolean padded)
-
getDomainParameters
public static org.bouncycastle.crypto.params.DHParameters getDomainParameters(TlsDHConfig dhConfig)
-
calculateDHAgreement
public BcTlsSecret calculateDHAgreement(org.bouncycastle.crypto.params.DHPrivateKeyParameters privateKey, org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey)
-
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 org.bouncycastle.crypto.params.DHPublicKeyParameters decodePublicKey(byte[] encoding) throws java.io.IOException
- Throws:
java.io.IOException
-
encodeParameter
public byte[] encodeParameter(java.math.BigInteger x)
-
encodePublicKey
public byte[] encodePublicKey(org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey)
-
generateKeyPair
public org.bouncycastle.crypto.AsymmetricCipherKeyPair generateKeyPair()
-
-