Class EciesEnvelopeKey
java.lang.Object
io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEnvelopeKey
The ECIES Envelope Key represents a temporary key for ECIES encryption and decryption
process. The key is derived from shared secret produced in ECDH key agreement.
The derivation function is X9.63 with SHA256 digest. Additionally this class holds the ephemeral public key
which is either generated or received from the client.
- Author:
- Roman Strobl, roman.strobl@wultra.com
-
Constructor Summary
ConstructorsConstructorDescriptionEciesEnvelopeKey(byte[] secretKey, byte[] ephemeralPublicKey) EciesEnvelopeKey constructor with secret key and ephemeral public key. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]deriveIvForNonce(byte[] nonce) Derive initialization vector from IV key and provided nonce.byte[]Get secret key for encryption or decryption.byte[]Get ephemeral public key.byte[]getIvKey()Get key for AES-CBC IV derivation.byte[]Get key for HMAC calculation.byte[]Get the complete secret key for ECIES.booleanisValid()Get whether derived secret key is valid.
-
Constructor Details
-
EciesEnvelopeKey
public EciesEnvelopeKey(byte[] secretKey, byte[] ephemeralPublicKey) EciesEnvelopeKey constructor with secret key and ephemeral public key.- Parameters:
secretKey- Derived secret key.ephemeralPublicKey- Ephemeral public key.
-
-
Method Details
-
getEncKey
Get secret key for encryption or decryption.- Returns:
- Secret key for encryption or decryption.
- Throws:
EciesException- In case encryption key is not valid.
-
getMacKey
Get key for HMAC calculation.- Returns:
- Key for HMAC calculation.
- Throws:
EciesException- In case MAC key is not valid.
-
getIvKey
Get key for AES-CBC IV derivation.- Returns:
- Key for AES-CBC IV derivation.
- Throws:
EciesException- In case IV key is not valid.
-
deriveIvForNonce
Derive initialization vector from IV key and provided nonce.- Parameters:
nonce- Nonce to be used in IV derivation.- Returns:
- Derived initialization vector.
- Throws:
EciesException- In case that nonce is not valid, or HMAC calculation failed.
-
getSecretKey
Get the complete secret key for ECIES.- Returns:
- Secret key for ECIES.
- Throws:
EciesException- In case secret key is not valid.
-
getEphemeralKeyPublic
public byte[] getEphemeralKeyPublic()Get ephemeral public key.- Returns:
- Ephemeral public key.
-
isValid
public boolean isValid()Get whether derived secret key is valid.- Returns:
- Whether derived secret key is valid.
-