public static Mac getMac(HashAlgorithm hashAlgorithm) { try { if (hashAlgorithm.needsBouncyCastle) { registerBouncyCastle(); return Mac.getInstance(hashAlgorithm.jceHmacId, "BC"); } else { return Mac.getInstance(hashAlgorithm.jceHmacId); } } catch (GeneralSecurityException e) { throw new EncryptedDocumentException("hmac algo not supported", e); } }
public static MessageDigest getMessageDigest(HashAlgorithm hashAlgorithm) { try { if (hashAlgorithm.needsBouncyCastle) { registerBouncyCastle(); return MessageDigest.getInstance(hashAlgorithm.jceId, "BC"); } else { return MessageDigest.getInstance(hashAlgorithm.jceId); } } catch (GeneralSecurityException e) { throw new EncryptedDocumentException("hash algo not supported", e); } }
/** * Initialize the xml signing environment and the bouncycastle provider */ protected static synchronized void initXmlProvider() { if (isInitialized) { return; } isInitialized = true; try { Init.init(); RelationshipTransformService.registerDsigProvider(); CryptoFunctions.registerBouncyCastle(); } catch (Exception e) { throw new RuntimeException("Xml & BouncyCastle-Provider initialization failed", e); } }
cipher = Cipher.getInstance(cipherAlgorithm.jceId); } else if (cipherAlgorithm.needsBouncyCastle) { registerBouncyCastle(); cipher = Cipher.getInstance(cipherAlgorithm.jceId + "/" + chain.jceId + "/" + padding, "BC"); } else {
public static MessageDigest getMessageDigest(HashAlgorithm hashAlgorithm) { try { if (hashAlgorithm.needsBouncyCastle) { registerBouncyCastle(); return MessageDigest.getInstance(hashAlgorithm.jceId, "BC"); } else { return MessageDigest.getInstance(hashAlgorithm.jceId); } } catch (GeneralSecurityException e) { throw new EncryptedDocumentException("hash algo not supported", e); } }
public static Mac getMac(HashAlgorithm hashAlgorithm) { try { if (hashAlgorithm.needsBouncyCastle) { registerBouncyCastle(); return Mac.getInstance(hashAlgorithm.jceHmacId, "BC"); } else { return Mac.getInstance(hashAlgorithm.jceHmacId); } } catch (GeneralSecurityException e) { throw new EncryptedDocumentException("hmac algo not supported", e); } }
/** * Initialize the xml signing environment and the bouncycastle provider */ protected static synchronized void initXmlProvider() { if (isInitialized) { return; } isInitialized = true; try { Init.init(); RelationshipTransformService.registerDsigProvider(); CryptoFunctions.registerBouncyCastle(); } catch (Exception e) { throw new RuntimeException("Xml & BouncyCastle-Provider initialization failed", e); } }
cipher = Cipher.getInstance(cipherAlgorithm.jceId); } else if (cipherAlgorithm.needsBouncyCastle) { registerBouncyCastle(); cipher = Cipher.getInstance(cipherAlgorithm.jceId + "/" + chain.jceId + "/" + padding, "BC"); } else {