public class CryptoBox extends Object
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
authData |
private org.bouncycastle.crypto.modes.AEADBlockCipher |
cipher |
private byte[] |
key |
| Constructor and Description |
|---|
CryptoBox() |
CryptoBox(byte[] key)
Initializes the box providing the secret key
|
CryptoBox(KeyPair keyPair)
Initializes the box providing KeyPair as parameter
|
CryptoBox(PrivateKey key)
Initializes the box providing the secret key
|
CryptoBox(PrivateKey privateKey,
PublicKey publicKey)
Initializes the box providing the key pair for asymmetric encryption
|
CryptoBox(PublicKey key)
Initializes the box providing the public key
|
CryptoBox(String key,
Encoder encoder)
Initializes the box providing the secret key and encoder
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] IV,
byte[] cipherText)
Given the IV, decrypt the provided data
|
byte[] |
decrypt(String IV,
String cipherText,
Encoder encoder)
Given the IV, decrypt the provided data
|
byte[] |
encrypt(byte[] IV,
byte[] message)
Given the IV, encrypt the provided data
|
byte[] |
encrypt(String IV,
String message,
Encoder encoder)
Given the IV, encrypt and encode the provided data
|
byte[] |
generateSecret(PrivateKey privateKey,
PublicKey publicKey) |
private byte[] key
private org.bouncycastle.crypto.modes.AEADBlockCipher cipher
private byte[] authData
public CryptoBox()
public CryptoBox(byte[] key)
key - byte arraypublic CryptoBox(PrivateKey key)
key - reference to the PrivateKeypublic CryptoBox(PublicKey key)
key - reference to the PublicKeypublic CryptoBox(String key, Encoder encoder)
key - encoder - public CryptoBox(PrivateKey privateKey, PublicKey publicKey)
privateKey - publicKey - public CryptoBox(KeyPair keyPair)
keyPair - public byte[] generateSecret(PrivateKey privateKey, PublicKey publicKey)
public byte[] encrypt(byte[] IV,
byte[] message)
throws RuntimeException
IV - initialization vectormessage - data to be encryptedRuntimeExceptionpublic byte[] encrypt(String IV, String message, Encoder encoder)
IV - initialization vectormessage - data to be encryptedencoder - encoder provided RAW or HEXpublic byte[] decrypt(byte[] IV,
byte[] cipherText)
throws RuntimeException
IV - initialization vectorcipherText - data to be decryptedRuntimeExceptionCopyright © 2016 JBoss by Red Hat. All Rights Reserved.