public class HybridCryptography
extends java.lang.Object
| Constructor | Description |
|---|---|
HybridCryptography() |
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.String |
decrypt(EncryptionPacket packet,
java.security.PrivateKey key,
byte[] aadData) |
Attempts to decrypt the string using both symmetric and asymmetric techniques
|
static java.lang.String[] |
encrypt(java.lang.String input,
java.security.PublicKey key,
javax.crypto.spec.GCMParameterSpec gcmParamSpec,
byte[] aadData) |
Attempts to encrypt the string using both symmetric and asymmetric techniques
|
static java.security.KeyPair |
generateKeys() |
public static java.security.KeyPair generateKeys()
throws java.security.NoSuchAlgorithmException
KeyPair used for RSA encryption/decryptionjava.security.NoSuchAlgorithmException - if someone messed with the code and changed
the algorithm to one that is invalidpublic static java.lang.String[] encrypt(java.lang.String input,
java.security.PublicKey key,
javax.crypto.spec.GCMParameterSpec gcmParamSpec,
byte[] aadData)
input - String input that is to be encryptedkey - PublicKey used for asymmetric encryptiongcmParamSpec - GCM Parameter Specifications used for the encryptionaadData - extra data tag to be included within the final encryptionpublic static java.lang.String decrypt(EncryptionPacket packet, java.security.PrivateKey key, byte[] aadData) throws java.lang.Exception
packet - EncryptionPacket that contains the encrypted datakey - PrivateKey used for the asymmetric decryptionaadData - the extra data tag used during the encryptionjava.lang.Exception