|
|
|
@ -213,7 +213,8 @@ public class CryptoFunctions {
|
|
|
|
|
cipher = Cipher.getInstance(cipherAlgorithm.jceId); |
|
|
|
|
} else if (cipherAlgorithm.needsBouncyCastle) { |
|
|
|
|
registerBouncyCastle(); |
|
|
|
|
cipher = Cipher.getInstance(cipherAlgorithm.jceId + "/" + chain.jceId + "/" + padding, "BC"); |
|
|
|
|
// [BouncyCastle]
|
|
|
|
|
cipher = Cipher.getInstance(cipherAlgorithm.jceId + "/" + chain.jceId + "/" + padding, "FR_BC"); |
|
|
|
|
} else { |
|
|
|
|
cipher = Cipher.getInstance(cipherAlgorithm.jceId + "/" + chain.jceId + "/" + padding); |
|
|
|
|
} |
|
|
|
@ -272,7 +273,8 @@ public class CryptoFunctions {
|
|
|
|
|
try { |
|
|
|
|
if (hashAlgorithm.needsBouncyCastle) { |
|
|
|
|
registerBouncyCastle(); |
|
|
|
|
return MessageDigest.getInstance(hashAlgorithm.jceId, "BC"); |
|
|
|
|
// [BouncyCastle]
|
|
|
|
|
return MessageDigest.getInstance(hashAlgorithm.jceId, "FR_BC"); |
|
|
|
|
} else { |
|
|
|
|
return MessageDigest.getInstance(hashAlgorithm.jceId); |
|
|
|
|
} |
|
|
|
@ -285,7 +287,8 @@ public class CryptoFunctions {
|
|
|
|
|
try { |
|
|
|
|
if (hashAlgorithm.needsBouncyCastle) { |
|
|
|
|
registerBouncyCastle(); |
|
|
|
|
return Mac.getInstance(hashAlgorithm.jceHmacId, "BC"); |
|
|
|
|
// [BouncyCastle]
|
|
|
|
|
return Mac.getInstance(hashAlgorithm.jceHmacId, "FR_BC"); |
|
|
|
|
} else { |
|
|
|
|
return Mac.getInstance(hashAlgorithm.jceHmacId); |
|
|
|
|
} |
|
|
|
@ -296,7 +299,8 @@ public class CryptoFunctions {
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
public static void registerBouncyCastle() { |
|
|
|
|
if (Security.getProvider("BC") != null) return; |
|
|
|
|
// [BouncyCastle]
|
|
|
|
|
if (Security.getProvider("FR_BC") != null) return; |
|
|
|
|
try { |
|
|
|
|
ClassLoader cl = Thread.currentThread().getContextClassLoader(); |
|
|
|
|
String bcProviderName = "org.bouncycastle.jce.provider.BouncyCastleProvider"; |
|
|
|
|