|
|
@ -238,7 +238,8 @@ public final 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); |
|
|
|
} |
|
|
|
} |
|
|
@ -297,7 +298,8 @@ public final 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); |
|
|
|
} |
|
|
|
} |
|
|
@ -310,7 +312,8 @@ public final 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); |
|
|
|
} |
|
|
|
} |
|
|
@ -321,10 +324,8 @@ public final class CryptoFunctions { |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public static void registerBouncyCastle() { |
|
|
|
public static void registerBouncyCastle() { |
|
|
|
if (Security.getProvider("BC") != null) { |
|
|
|
// [BouncyCastle]
|
|
|
|
return; |
|
|
|
if (Security.getProvider("FR_BC") != null) return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
ClassLoader cl = CryptoFunctions.class.getClassLoader(); |
|
|
|
ClassLoader cl = CryptoFunctions.class.getClassLoader(); |
|
|
|
String bcProviderName = "com.fr.third.v2.org.bouncycastle.jce.provider.BouncyCastleProvider"; |
|
|
|
String bcProviderName = "com.fr.third.v2.org.bouncycastle.jce.provider.BouncyCastleProvider"; |
|
|
|