public void setMacName(String macName) { this.macName = macName; try { this.mac = Mac.getInstance(this.macName, Crypto.getCryptoProvider()); } catch (GeneralSecurityException e) { throw new IllegalArgumentException(e); } }
public void setCipherAlgorithmNameModePadding(String cipherAlgorithmNameModePadding) { String cipherAlgorithmExpected, cipherAlgorithmReceived; cipherAlgorithmExpected = this.getCipherAlgorithm(); cipherAlgorithmReceived = CryptoUtil.getCipherNameAsString(cipherAlgorithmNameModePadding); if (!cipherAlgorithmExpected.equals(cipherAlgorithmReceived)) { throw new IllegalArgumentException("algorithm must be " + cipherAlgorithmExpected); } this.cipherAlgorithmNameModePadding = cipherAlgorithmNameModePadding; try { this.cipher = Cipher.getInstance(this.cipherAlgorithmNameModePadding, Crypto.getCryptoProvider()); } catch (GeneralSecurityException e) { logException(getClass(), e); throw new IllegalArgumentException(e); } }