public class AbsioIESHelper extends Object
AbsioIESStruct for managing the data contained in the AbsioIES format. AbsioIES uses ECDH (see KeyAgreementHelper) to create the key used to encrypt the data using CipherTransformation.AES_CTR_NOPADDING.
It also uses ECDSA to sign the encrypted data (see SignatureHelper and SignatureHelper.SignatureAlgorithm#SHA384WithECDSA.| Constructor and Description |
|---|
AbsioIESHelper()
Create the helper.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] data,
ECPublicKey signingPublicKey,
ECPrivateKey derivationPrivateKey)
Decrypt the AbsioIES formatted data.
|
byte[] |
decrypt(byte[] data,
PublicKey signingPublicKey,
PrivateKey derivationPrivateKey)
Decrypt the AbsioIES formatted data.
|
byte[] |
encrypt(byte[] data,
IndexedECPrivateKey signingPrivateKey,
IndexedECPublicKey derivationPublicKey,
UUID userId,
UUID objectId)
Perform the AbsioIES encryption of the data.
|
byte[] |
encrypt(byte[] data,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID userId)
Perform the AbsioIES encryption of the data.
|
byte[] |
encrypt(byte[] data,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID userId,
UUID objectId)
Perform the AbsioIES encryption of the data.
|
AbsioIESStruct |
parseStruct(byte[] data)
This will parse the AbsioIES formatted data into a
AbsioIESStruct. |
public AbsioIESHelper()
throws NoSuchAlgorithmException,
NoSuchPaddingException
NoSuchAlgorithmException - thrown if CipherTransformation.AES_CTR_NOPADDING is not supportedNoSuchPaddingException - thrown if CipherTransformation.AES_CTR_NOPADDING is not supportedpublic byte[] decrypt(byte[] data,
PublicKey signingPublicKey,
PrivateKey derivationPrivateKey)
throws IOException,
InvalidKeyException,
SignatureException,
IllegalBlockSizeException,
BadPaddingException,
InvalidAlgorithmParameterException,
InvalidKeySpecException
data - the AbsioIES formatted datasigningPublicKey - the public signing key of the creator used to ECDSA sign the ciphertextderivationPrivateKey - the private derivation key used in the ECDH key exchangeIOException - thrown if there are any IO issues processing the dataInvalidKeyException - thrown if the key is not validSignatureException - thrown if the signature of the encrypted data is not correctIllegalBlockSizeException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedBadPaddingException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidAlgorithmParameterException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidKeySpecException - thrown if the key is not validpublic byte[] decrypt(byte[] data,
ECPublicKey signingPublicKey,
ECPrivateKey derivationPrivateKey)
throws IOException,
InvalidKeyException,
SignatureException,
IllegalBlockSizeException,
BadPaddingException,
InvalidAlgorithmParameterException,
InvalidKeySpecException
data - the AbsioIES formatted datasigningPublicKey - the public signing key of the creator used to ECDSA sign the ciphertextderivationPrivateKey - the private derivation key used in the ECDH key exchangeIOException - thrown if there are any IO issues processing the dataInvalidKeyException - thrown if the key is not validSignatureException - thrown if the signature of the encrypted data is not correctIllegalBlockSizeException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedBadPaddingException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidAlgorithmParameterException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidKeySpecException - thrown if the key is not validpublic byte[] encrypt(byte[] data,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID userId)
throws InvalidAlgorithmParameterException,
InvalidKeyException,
BadPaddingException,
IllegalBlockSizeException,
SignatureException,
IOException
CipherTransformation.AES_CTR_NOPADDING with a ECDH generated key. The resulting ciphertext will be ECDSA signed
with the private signing key. NOTE: this will fail if the keys are not EC keys! Also, this will create a random
id for the object.data - the data to encryptsigningPrivateKey - the private signing key of the creator that will ECDSA sign the ciphertextderivationPublicKey - he public derivation key used in the ECDH key exchangeuserId - the user's id calling this method (the signer)InvalidAlgorithmParameterException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidKeyException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedBadPaddingException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedIllegalBlockSizeException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedSignatureException - thrown if there is an issue signing the ciphertextIOException - thrown if there are any IO issues processing the datapublic byte[] encrypt(byte[] data,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID userId,
UUID objectId)
throws InvalidAlgorithmParameterException,
InvalidKeyException,
BadPaddingException,
IllegalBlockSizeException,
SignatureException,
IOException
CipherTransformation.AES_CTR_NOPADDING with a ECDH generated key. The resulting ciphertext will be ECDSA signed
with the private signing key. NOTE: this will fail if the keys are not EC keys!data - the data to encryptsigningPrivateKey - the private signing key of the creator that will ECDSA sign the ciphertextderivationPublicKey - he public derivation key used in the ECDH key exchangeuserId - the user's id calling this method (the signer)objectId - the id of the data in the AbsioIES structureInvalidAlgorithmParameterException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidKeyException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedBadPaddingException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedIllegalBlockSizeException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedSignatureException - thrown if there is an issue signing the ciphertextIOException - thrown if there are any IO issues processing the datapublic byte[] encrypt(byte[] data,
IndexedECPrivateKey signingPrivateKey,
IndexedECPublicKey derivationPublicKey,
UUID userId,
UUID objectId)
throws InvalidAlgorithmParameterException,
InvalidKeyException,
BadPaddingException,
IllegalBlockSizeException,
SignatureException,
IOException
CipherTransformation.AES_CTR_NOPADDING with a ECDH generated key. The resulting ciphertext will be ECDSA signed
with the private signing key.data - the data to encryptsigningPrivateKey - the private signing key of the creator that will ECDSA sign the ciphertextderivationPublicKey - he public derivation key used in the ECDH key exchangeuserId - the user's id calling this method (the signer)objectId - the id of the data in the AbsioIES structureInvalidAlgorithmParameterException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedInvalidKeyException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedBadPaddingException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedIllegalBlockSizeException - thrown if CipherTransformation.AES_CTR_NOPADDING is not
supportedSignatureException - thrown if there is an issue signing the ciphertextIOException - thrown if there are any IO issues processing the datapublic AbsioIESStruct parseStruct(byte[] data) throws IOException
AbsioIESStruct.data - the AbsioIES formatted dataAbsioIESStructIOException - thrown if there were any IO issuesCopyright © 2021. All rights reserved.