public class ECDHSupport extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
EC_PUBLIC_KEY_OID
The Object Identifier for an EC public key.
|
| Constructor and Description |
|---|
ECDHSupport() |
| Modifier and Type | Method and Description |
|---|---|
static KeyAgreementCredential |
createKeyAgreementCredential(Credential peerCredential,
String keyWrappingAlgorithm,
KeyDerivationMethod keyDerivationMethod)
Creates a
KeyAgreementCredential by using the supplied peer credential to generate a EC key pair and a
secret key that is the key agreement key. |
static SecretKey |
getKeyAgreementKey(PrivateKey decrypterKey,
AgreementMethod agreementMethod,
String keyWrappingJcaAlgorithmId,
int keyWrappingKeySize)
Derives the ephemeral-static DH agreed key encryption key for a decryption process.
|
static NamedCurve |
getNamedCurve(ECPublicKey publicKey)
Given a EC public key its named curve is returned.
|
public static final String EC_PUBLIC_KEY_OID
public static KeyAgreementCredential createKeyAgreementCredential(Credential peerCredential, String keyWrappingAlgorithm, KeyDerivationMethod keyDerivationMethod) throws SecurityException
KeyAgreementCredential by using the supplied peer credential to generate a EC key pair and a
secret key that is the key agreement key.
This method works only for the key derivation algorithm.
peerCredential - the peer credential (containing an EC public key)keyWrappingAlgorithm - the key wrapping algorithmkeyDerivationMethod - the key derivation method parameters for the key derivation algorithmSecurityException - for errors during the key generation processpublic static SecretKey getKeyAgreementKey(PrivateKey decrypterKey, AgreementMethod agreementMethod, String keyWrappingJcaAlgorithmId, int keyWrappingKeySize) throws SecurityException
ECDH is used to calculate the shared secret.
The ConcatKDF key derivation function is assumed and required for constructing the derived key encryption key.
decrypterKey - The private EC key of the decrypteragreementMethod - the AgreementMethod elementkeyWrappingJcaAlgorithmId - the JCA algorithm ID for the key wrapping methodkeyWrappingKeySize - the key size for the key wrapping algorithmSecurityException - for error during the processpublic static NamedCurve getNamedCurve(ECPublicKey publicKey)
publicKey - the public keynull if the curve is not supportedCopyright © 2020 Sweden Connect. All rights reserved.