public class SecurityHelpers
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static javax.crypto.SecretKey |
bytes2SecretKeyDESede(byte[] bytes) |
static byte[] |
createDigestMD5(byte[] bytes) |
static java.security.KeyPair |
createKeyPairRSA() |
static javax.crypto.SecretKey |
createSecretKeyDESede() |
static byte[] |
createSignatureMD5RSA(byte[] bytes,
java.security.PrivateKey privateKey) |
static javax.net.ssl.SSLContext |
createSSLContextTLS(java.net.URL p12KsUrl,
java.lang.String ksPass) |
static byte[] |
cryptRSA(byte[] bytes,
java.security.Key key) |
static byte[] |
decryptDESede(javax.crypto.SecretKey key,
byte[] bytes) |
static byte[] |
encryptDESede(javax.crypto.SecretKey key,
byte[] bytes) |
static java.lang.String |
encryptPasswordPbkdf2(java.lang.String password) |
static void |
extractKeystoreCert(java.security.KeyStore ks,
java.lang.String alias,
java.io.File to) |
static java.security.cert.Certificate |
getKeystoreCert(java.security.KeyStore ks,
java.lang.String alias) |
static java.security.PrivateKey |
getKeystoreKey(java.security.KeyStore ks,
java.lang.String alias,
java.lang.String keyPass) |
static java.security.cert.Certificate |
loadCertX509(java.net.URL url) |
static java.security.KeyStore |
loadKeyStoreJKS(java.net.URL url,
java.lang.String ksPass) |
static java.security.KeyStore |
loadKeyStorePKCS12(java.net.URL url,
java.lang.String ksPass) |
static java.security.cert.X509Certificate |
pem64ToCertX509(java.lang.String certPem64) |
static java.security.interfaces.RSAPublicKey |
pem64ToPublicKeyRSA(java.lang.String pubKeyPem64) |
static byte[] |
secretKey2BytesDESede(javax.crypto.SecretKey key) |
static boolean |
verifySignatureMD5RSA(byte[] bytes,
byte[] signature,
java.security.PublicKey publicKey) |
static boolean |
verifySignatureSHA256RSA(byte[] bytes,
byte[] signature,
java.security.PublicKey publicKey) |
public static javax.net.ssl.SSLContext createSSLContextTLS(java.net.URL p12KsUrl, java.lang.String ksPass) throws java.lang.Exception
java.lang.Exception
public static byte[] createDigestMD5(byte[] bytes) throws java.lang.Exception
java.lang.Exception
public static java.security.KeyPair createKeyPairRSA() throws java.lang.Exception
java.lang.Exception
public static byte[] createSignatureMD5RSA(byte[] bytes, java.security.PrivateKey privateKey) throws java.lang.Exception
java.lang.Exception
public static boolean verifySignatureMD5RSA(byte[] bytes, byte[] signature, java.security.PublicKey publicKey) throws java.lang.Exception
java.lang.Exception
public static java.security.interfaces.RSAPublicKey pem64ToPublicKeyRSA(java.lang.String pubKeyPem64)
public static java.security.cert.X509Certificate pem64ToCertX509(java.lang.String certPem64)
public static boolean verifySignatureSHA256RSA(byte[] bytes, byte[] signature, java.security.PublicKey publicKey)
public static byte[] encryptDESede(javax.crypto.SecretKey key, byte[] bytes) throws java.lang.Exception
java.lang.Exception
public static byte[] decryptDESede(javax.crypto.SecretKey key, byte[] bytes) throws java.lang.Exception
java.lang.Exception
public static byte[] cryptRSA(byte[] bytes, java.security.Key key) throws java.lang.Exception
java.lang.Exception
public static javax.crypto.SecretKey createSecretKeyDESede() throws java.lang.Exception
java.lang.Exception
public static byte[] secretKey2BytesDESede(javax.crypto.SecretKey key) throws java.lang.Exception
java.lang.Exception
public static javax.crypto.SecretKey bytes2SecretKeyDESede(byte[] bytes) throws java.lang.Exception
java.lang.Exception
public static java.security.cert.Certificate loadCertX509(java.net.URL url) throws java.lang.Exception
java.lang.Exception
public static void extractKeystoreCert(java.security.KeyStore ks, java.lang.String alias, java.io.File to) throws java.lang.Exception
java.lang.Exception
public static java.security.KeyStore loadKeyStorePKCS12(java.net.URL url, java.lang.String ksPass) throws java.lang.Exception
java.lang.Exception
public static java.security.KeyStore loadKeyStoreJKS(java.net.URL url, java.lang.String ksPass) throws java.lang.Exception
java.lang.Exception
public static java.security.cert.Certificate getKeystoreCert(java.security.KeyStore ks, java.lang.String alias) throws java.lang.Exception
java.lang.Exception
public static java.security.PrivateKey getKeystoreKey(java.security.KeyStore ks, java.lang.String alias, java.lang.String keyPass) throws java.lang.Exception
java.lang.Exception
public static java.lang.String encryptPasswordPbkdf2(java.lang.String password) throws java.lang.Exception
java.lang.Exception