public class ECCHelper extends Object
| Constructor and Description |
|---|
ECCHelper()
Default constructor that will create a helper that uses
EllipticCurve.P384 and AESKeyStrength.AES256 for the curve and key strength respectively. |
ECCHelper(EllipticCurve curve,
AESKeyStrength keyStrength)
Constructor that will create a helper that uses the defined
EllipticCurve and AES Key Strength. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
absioIESDecrypt(byte[] absioIESData,
ECPublicKey signingPublicKey,
ECPrivateKey derivationPrivateKey)
This will decrypt the data that was encrypted using Absio's Integrated Encryption Scheme (IES) that utilizes
Elliptical Curve Cryptography (AbsioIES).
|
byte[] |
absioIESDecrypt(byte[] absioIESData,
PublicKey signingPublicKey,
PrivateKey derivationPrivateKey)
This will decrypt the data that was encrypted using Absio's Integrated Encryption Scheme (IES) that utilizes
Elliptical Curve Cryptography (AbsioIES).
|
byte[] |
absioIESEncrypt(byte[] plaintext,
IndexedECPrivateKey signingPrivateKey,
IndexedECPublicKey derivationPublicKey,
UUID encryptorsId,
UUID objectId)
This will encrypt the data using Absio's Integrated Encryption Scheme (IES) that utilizes Elliptical Curve
Cryptography (AbsioIES).
|
byte[] |
absioIESEncrypt(byte[] plaintext,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID encryptorsId)
This will encrypt the data using Absio's Integrated Encryption Scheme (IES) that utilizes Elliptical Curve
Cryptography (AbsioIES).
|
byte[] |
absioIESEncrypt(byte[] plaintext,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID encryptorsId,
UUID objectId)
This will encrypt the data using Absio's Integrated Encryption Scheme (IES) that utilizes Elliptical Curve
Cryptography (AbsioIES).
|
byte[] |
generateDHSharedKey(PrivateKey privateKey,
PublicKey publicKey)
This will return the ECDH shared secret key the private and public key.
|
byte[] |
generateDHSharedSecret(PrivateKey privateKey,
PublicKey publicKey)
This will return the ECDH shared secret given the private and public key.
|
KeyPair |
generateKey()
This will create a new Elliptic Curve
KeyPair using the helpers defined EllipticCurve NOTE: this
uses KeyPairHelper with KeyPairHelper.KeyAlgorithm#EC to generate the key. |
EllipticCurve |
getCurve()
This is the
EllipticCurve used by this helper. |
AESKeyStrength |
getKeyStrength()
This is the
AESKeyStrength used in when generating an ECDH shared key. |
byte[] |
sign(PrivateKey privateKey,
byte[] data)
ECDSA signs the given data with the given key.
|
boolean |
verifySignature(PublicKey publicKey,
byte[] data,
byte[] signature)
Verifies a ECDSA signature of the given data.
|
public ECCHelper()
throws NoSuchAlgorithmException,
NoSuchPaddingException
EllipticCurve.P384 and AESKeyStrength.AES256 for the curve and key strength respectively.NoSuchAlgorithmException - thrown if ECDH is not supportedNoSuchPaddingException - thrown is AES256 CTR NoPadding is not supportedpublic ECCHelper(EllipticCurve curve, AESKeyStrength keyStrength) throws NoSuchAlgorithmException, NoSuchPaddingException
EllipticCurve and AES Key Strength.curve - the EllipticCurve of this helperkeyStrength - the AESKeyStrength of this helperNoSuchAlgorithmException - thrown if EllipticCurve is not supportedNoSuchPaddingException - thrown if padding of the AESKeyStrength is not supportedpublic byte[] absioIESDecrypt(byte[] absioIESData,
PublicKey signingPublicKey,
PrivateKey derivationPrivateKey)
throws IllegalBlockSizeException,
InvalidAlgorithmParameterException,
IOException,
BadPaddingException,
SignatureException,
InvalidKeyException,
InvalidKeySpecException
absioIESData - the Absio IES datasigningPublicKey - the public key of the private key used to sign the encrypted dataderivationPrivateKey - the private key of the public key used to perform ECDH to generate the shared secret
keyIOException - 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[] absioIESDecrypt(byte[] absioIESData,
ECPublicKey signingPublicKey,
ECPrivateKey derivationPrivateKey)
throws IllegalBlockSizeException,
InvalidAlgorithmParameterException,
IOException,
BadPaddingException,
SignatureException,
InvalidKeyException,
InvalidKeySpecException
absioIESData - the Absio IES datasigningPublicKey - the public key of the private key used to sign the encrypted dataderivationPrivateKey - the private key of the public key used to perform ECDH to generate the shared secret
keyIOException - 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[] absioIESEncrypt(byte[] plaintext,
IndexedECPrivateKey signingPrivateKey,
IndexedECPublicKey derivationPublicKey,
UUID encryptorsId,
UUID objectId)
throws BadPaddingException,
InvalidKeyException,
IllegalBlockSizeException,
SignatureException,
InvalidAlgorithmParameterException,
IOException
plaintext - the data to be encryptedsigningPrivateKey - the key used to sign the encrypted dataderivationPublicKey - the key used to perform ECDH to generate the shared secret keyencryptorsId - the unique id of the user encrypting the dataobjectId - the unique id of the formatted data - encrypted data with additional process dataInvalidAlgorithmParameterException - 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[] absioIESEncrypt(byte[] plaintext,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID encryptorsId,
UUID objectId)
throws BadPaddingException,
InvalidKeyException,
IllegalBlockSizeException,
SignatureException,
InvalidAlgorithmParameterException,
IOException
plaintext - the data to be encryptedsigningPrivateKey - the key used to sign the encrypted dataderivationPublicKey - the key used to perform ECDH to generate the shared secret keyencryptorsId - the unique id of the user encrypting the dataobjectId - the unique id of the formatted data - encrypted data with additional process dataInvalidAlgorithmParameterException - 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[] absioIESEncrypt(byte[] plaintext,
PrivateKey signingPrivateKey,
PublicKey derivationPublicKey,
UUID encryptorsId)
throws BadPaddingException,
InvalidKeyException,
IllegalBlockSizeException,
SignatureException,
InvalidAlgorithmParameterException,
IOException
plaintext - the data to be encryptedsigningPrivateKey - the key used to sign the encrypted dataderivationPublicKey - the key used to perform ECDH to generate the shared secret keyencryptorsId - the unique id of the user encrypting the dataInvalidAlgorithmParameterException - 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[] generateDHSharedKey(PrivateKey privateKey, PublicKey publicKey) throws InvalidKeyException
KeyAgreementHelper with
KeyAgreementHelper.KeyAgreementAlgorithm#ECDH to generate the secret and KDF2Helper with MessageDigestAlgorithm.SHA384 and the AESKeyStrength to generate the Key.privateKey - Alice's private keypublicKey - Bob's public keyInvalidKeyException - thrown if there was an error creating the shared secret keypublic byte[] generateDHSharedSecret(PrivateKey privateKey, PublicKey publicKey) throws InvalidKeyException
KeyAgreementHelper with
KeyAgreementHelper.KeyAgreementAlgorithm#ECDH to generate the secret.privateKey - Alice's private keypublicKey - Bob's public keyInvalidKeyException - thrown if the keys are not the correct typepublic KeyPair generateKey() throws InvalidAlgorithmParameterException
KeyPair using the helpers defined EllipticCurve NOTE: this
uses KeyPairHelper with KeyPairHelper.KeyAlgorithm#EC to generate the key.KeyPair using the defined curveInvalidAlgorithmParameterException - thrown if the curve is not supportedpublic EllipticCurve getCurve()
EllipticCurve used by this helper.EllipticCurve of this helperpublic AESKeyStrength getKeyStrength()
AESKeyStrength used in when generating an ECDH shared key.AESKeyStrength of this helperpublic byte[] sign(PrivateKey privateKey, byte[] data) throws SignatureException, InvalidKeyException
SignatureHelper with SignatureHelper.SignatureAlgorithm#SHA384WithECDSA to complete the signing of the data.privateKey - the private key used to sign the datadata - the data to signSignatureException - thrown if there was an issue signing the dataInvalidKeyException - thrown if there was an issue with the keypublic boolean verifySignature(PublicKey publicKey, byte[] data, byte[] signature) throws SignatureException, InvalidKeyException
SignatureHelper with SignatureHelper.SignatureAlgorithm#SHA384WithECDSA to verify the signature of the data.publicKey - the public key of the private key used to sign the datadata - the data that was signedsignature - the signatureSignatureException - thrown if there was an issue verifying the signature of the dataInvalidKeyException - thrown if there was an issue with the keyCopyright © 2021. All rights reserved.