Class KeyAgreementSpi
java.lang.Object
javax.crypto.KeyAgreementSpi
org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi
org.bouncycastle.jcajce.provider.asymmetric.dh.KeyAgreementSpi
- Direct Known Subclasses:
KeyAgreementSpi.DHUwithSHA1CKDF
,KeyAgreementSpi.DHUwithSHA1KDF
,KeyAgreementSpi.DHUwithSHA224CKDF
,KeyAgreementSpi.DHUwithSHA224KDF
,KeyAgreementSpi.DHUwithSHA256CKDF
,KeyAgreementSpi.DHUwithSHA256KDF
,KeyAgreementSpi.DHUwithSHA384CKDF
,KeyAgreementSpi.DHUwithSHA384KDF
,KeyAgreementSpi.DHUwithSHA512CKDF
,KeyAgreementSpi.DHUwithSHA512KDF
,KeyAgreementSpi.DHwithRFC2631KDF
,KeyAgreementSpi.DHwithSHA1CKDF
,KeyAgreementSpi.DHwithSHA1KDF
,KeyAgreementSpi.DHwithSHA224CKDF
,KeyAgreementSpi.DHwithSHA224KDF
,KeyAgreementSpi.DHwithSHA256CKDF
,KeyAgreementSpi.DHwithSHA256KDF
,KeyAgreementSpi.DHwithSHA384CKDF
,KeyAgreementSpi.DHwithSHA384KDF
,KeyAgreementSpi.DHwithSHA512CKDF
,KeyAgreementSpi.DHwithSHA512KDF
,KeyAgreementSpi.MQVwithSHA1CKDF
,KeyAgreementSpi.MQVwithSHA1KDF
,KeyAgreementSpi.MQVwithSHA224CKDF
,KeyAgreementSpi.MQVwithSHA224KDF
,KeyAgreementSpi.MQVwithSHA256CKDF
,KeyAgreementSpi.MQVwithSHA256KDF
,KeyAgreementSpi.MQVwithSHA384CKDF
,KeyAgreementSpi.MQVwithSHA384KDF
,KeyAgreementSpi.MQVwithSHA512CKDF
,KeyAgreementSpi.MQVwithSHA512KDF
Diffie-Hellman key agreement. There's actually a better way of doing this
if you are using long term public keys, see the light-weight version for
details.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
-
Field Summary
Fields inherited from class org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi
kaAlgorithm, kdf, ukmParameters, ukmParametersSalt
-
Constructor Summary
ConstructorDescriptionKeyAgreementSpi
(String kaAlgorithm, DHUnifiedAgreement unifiedAgreement, DerivationFunction kdf) KeyAgreementSpi
(String kaAlgorithm, BasicAgreement mqvAgreement, DerivationFunction kdf) KeyAgreementSpi
(String kaAlgorithm, DerivationFunction kdf) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
protected byte[]
protected void
doInitFromKey
(Key key, AlgorithmParameterSpec params, SecureRandom random) protected Key
engineDoPhase
(Key key, boolean lastPhase) protected byte[]
protected int
engineGenerateSecret
(byte[] sharedSecret, int offset) protected SecretKey
engineGenerateSecret
(String algorithm) protected void
engineInit
(Key key, SecureRandom random) Methods inherited from class org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi
engineInit, getAlgorithm, getKeySize, trimZeroes
-
Constructor Details
-
KeyAgreementSpi
public KeyAgreementSpi() -
KeyAgreementSpi
-
KeyAgreementSpi
public KeyAgreementSpi(String kaAlgorithm, DHUnifiedAgreement unifiedAgreement, DerivationFunction kdf) -
KeyAgreementSpi
-
-
Method Details
-
bigIntToBytes
-
engineDoPhase
protected Key engineDoPhase(Key key, boolean lastPhase) throws InvalidKeyException, IllegalStateException - Specified by:
engineDoPhase
in classKeyAgreementSpi
- Throws:
InvalidKeyException
IllegalStateException
-
engineGenerateSecret
- Overrides:
engineGenerateSecret
in classBaseAgreementSpi
- Throws:
IllegalStateException
-
engineGenerateSecret
protected int engineGenerateSecret(byte[] sharedSecret, int offset) throws IllegalStateException, ShortBufferException - Overrides:
engineGenerateSecret
in classBaseAgreementSpi
- Throws:
IllegalStateException
ShortBufferException
-
engineGenerateSecret
- Overrides:
engineGenerateSecret
in classBaseAgreementSpi
- Throws:
NoSuchAlgorithmException
-
doInitFromKey
protected void doInitFromKey(Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
doInitFromKey
in classBaseAgreementSpi
- Throws:
InvalidKeyException
InvalidAlgorithmParameterException
-
engineInit
- Overrides:
engineInit
in classBaseAgreementSpi
- Throws:
InvalidKeyException
-
doCalcSecret
protected byte[] doCalcSecret()- Specified by:
doCalcSecret
in classBaseAgreementSpi
-