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