public interface HeliosCrypto
| Modifier and Type | Method and Description |
|---|---|
byte[] |
createHMAC(byte[] data,
byte[] secret)
Calculates the HMAC (message authentication code) for a byte array using SHA 256.
|
javax.crypto.SecretKey |
decryptAESKey(java.security.PrivateKey decryptionRSAKey,
byte[] encryptedAESKey)
Decrypts an encrypted AES key using a RSA decryption key.
|
byte[] |
decryptBytes(byte[] cryptotextBytes,
javax.crypto.SecretKey AESKey,
byte[] iv)
Decrypts a cryptotext using AES in Galois Counter Mode and with NoPadding.
|
byte[] |
encryptAESKey(java.security.PublicKey encryptionRSAKey,
javax.crypto.SecretKey AESKey)
Encrypts an AES key using a RSA encryption key.
|
byte[] |
encryptBytes(byte[] plaintextBytes,
javax.crypto.SecretKey AESKey,
byte[] iv)
Encrypts an array of bytes using AES in Galois Counter Mode and with NoPadding.
|
javax.crypto.SecretKey |
generateAESKey()
Generates a random AES key.
|
java.security.KeyPair |
generateRSAKeyPair()
Generates a random RSA 2048 bit public key - private key pair for encryption or signing.
|
byte[] |
signBytes(java.security.PrivateKey signingRSAKey,
byte[] bytesToSign)
Signs a byte array using RSA and SHA 256.
|
boolean |
verifyBytes(java.security.PublicKey verificationRSAKey,
byte[] bytesToSign,
byte[] signatureToVerify)
Checks if a signature is valid, that is, generated with the private RSA key corresponding to the public key.
|
boolean |
verifyHMAC(byte[] hmac,
byte[] data,
byte[] secret)
Checks if a HMAC value is valid.
|
javax.crypto.SecretKey generateAESKey()
SecretKeyjava.security.KeyPair generateRSAKeyPair()
KeyPairbyte[] encryptAESKey(java.security.PublicKey encryptionRSAKey,
javax.crypto.SecretKey AESKey)
encryptionRSAKey - The RSA key that is used for encryption PublicKeyAESKey - The key that will be encrypted SecretKeyjavax.crypto.SecretKey decryptAESKey(java.security.PrivateKey decryptionRSAKey,
byte[] encryptedAESKey)
decryptionRSAKey - The RSA key that is used for decryption PrivateKeyencryptedAESKey - The AES key in encrypted form as byte arraySecretKeybyte[] encryptBytes(byte[] plaintextBytes,
javax.crypto.SecretKey AESKey,
byte[] iv)
plaintextBytes - The plaintextAESKey - The AES key that is used for encryption SecretKeyiv - The random initial value (12 bytes) that the method generates for GCMbyte[] decryptBytes(byte[] cryptotextBytes,
javax.crypto.SecretKey AESKey,
byte[] iv)
cryptotextBytes - The cryptotextAESKey - The AES key that is used for decryption SecretKeyiv - The initial value for GCM. Must be the same that was used in encryption, otherwise decryption fails.byte[] signBytes(java.security.PrivateKey signingRSAKey,
byte[] bytesToSign)
signingRSAKey - The RSA key that is used for signing PrivateKeybytesToSign - The byte array that is to be signedboolean verifyBytes(java.security.PublicKey verificationRSAKey,
byte[] bytesToSign,
byte[] signatureToVerify)
verificationRSAKey - The public RSA key that is used for verification PublicKeybytesToSign - The byte array that was signedsignatureToVerify - The signature that is to be verifiedbyte[] createHMAC(byte[] data,
byte[] secret)
data - The input bytessecret - The secret keyboolean verifyHMAC(byte[] hmac,
byte[] data,
byte[] secret)
hmac - The 256 bit HMAC that is to be checkeddata - The input that was used to generate the HMACsecret - The secret key that was used to generate the HMAC