public abstract class EncryptionHelper
extends java.lang.Object
| Constructor and Description |
|---|
EncryptionHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
extractAlgorithm(java.lang.String transformation) |
static int |
getKeyLength(java.security.PrivateKey pk) |
static int |
getKeyLength(java.security.PublicKey pk) |
static javax.crypto.Cipher |
initializeCipher(int mode,
java.lang.String transformation,
byte[] secret,
java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Initialize cipher.
|
static javax.crypto.Cipher |
initializeCipher(int mode,
java.lang.String transformation,
java.security.Key key,
java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Initialize cipher.
|
static java.security.Signature |
initializeSignature(java.lang.String algorithm,
java.security.Key key,
boolean sign) |
static int |
ivLength(java.lang.String transformation,
javax.crypto.Cipher cipher) |
static java.security.KeyStore |
loadKeyStore(java.lang.String keystorePath,
java.lang.String type,
char[] password) |
static byte[] |
randomIV(java.lang.String transformation,
javax.crypto.Cipher cipher) |
static boolean |
requiresIV(java.lang.String transformation) |
public static javax.crypto.Cipher initializeCipher(int mode,
java.lang.String transformation,
java.security.Key key,
java.io.InputStream inputStream,
java.io.OutputStream outputStream)
throws java.lang.Exception
mode - Encrypt or decrypt mode.transformation - Encryption algorithm.key - Private or public key depending on usage.inputStream - Encrypted input stream to read IV from. May be null in case of encryption mode.outputStream - Encryption output stream. May be null in case of decryption mode.java.lang.Exception - Indicates failure.public static javax.crypto.Cipher initializeCipher(int mode,
java.lang.String transformation,
byte[] secret,
java.io.InputStream inputStream,
java.io.OutputStream outputStream)
throws java.lang.Exception
mode - Encrypt or decrypt mode.transformation - Encryption algorithm.secret - Symmetric cryptography secret key.inputStream - Encrypted input stream to read IV from. May be null in case of encryption mode.outputStream - Encryption output stream. May be null in case of decryption mode.java.lang.Exception - Indicates failure.public static java.security.Signature initializeSignature(java.lang.String algorithm,
java.security.Key key,
boolean sign)
throws java.lang.Exception
java.lang.Exceptionpublic static java.security.KeyStore loadKeyStore(java.lang.String keystorePath,
java.lang.String type,
char[] password)
throws java.lang.Exception
java.lang.Exceptionpublic static int getKeyLength(java.security.PublicKey pk)
public static int getKeyLength(java.security.PrivateKey pk)
public static boolean requiresIV(java.lang.String transformation)
public static int ivLength(java.lang.String transformation,
javax.crypto.Cipher cipher)
public static java.lang.String extractAlgorithm(java.lang.String transformation)
public static byte[] randomIV(java.lang.String transformation,
javax.crypto.Cipher cipher)