/** * Returns an initialized <code>Mac</code> for the given <code>algorithm</code>. * * @param algorithm * the name of the algorithm requested. See <a href= * "http://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA" >Appendix * A in the Java Cryptography Architecture Reference Guide</a> for information about standard algorithm * names. * @param key * They key for the keyed digest (must not be null) * @return A Mac instance initialized with the given key. * @see Mac#getInstance(String) * @see Mac#init(Key) * @throws IllegalArgumentException * when a {@link NoSuchAlgorithmException} is caught or key is null or key is invalid. */ public static Mac getInitializedMac(final HmacAlgorithms algorithm, final byte[] key) { return getInitializedMac(algorithm.toString(), key); }
/** * Returns an initialized <code>Mac</code> for the given <code>algorithm</code>. * * @param algorithm * the name of the algorithm requested. See <a href= * "http://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA" >Appendix * A in the Java Cryptography Architecture Reference Guide</a> for information about standard algorithm * names. * @param key * They key for the keyed digest (must not be null) * @return A Mac instance initialized with the given key. * @see Mac#getInstance(String) * @see Mac#init(Key) * @throws IllegalArgumentException * when a {@link NoSuchAlgorithmException} is caught or key is null or key is invalid. */ public static Mac getInitializedMac(final HmacAlgorithms algorithm, final byte[] key) { return getInitializedMac(algorithm.toString(), key); }
/** * Returns an initialized <code>Mac</code> for the given <code>algorithm</code>. * * @param algorithm * the name of the algorithm requested. See <a href= * "http://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA" >Appendix * A in the Java Cryptography Architecture Reference Guide</a> for information about standard algorithm * names. * @param key * They key for the keyed digest (must not be null) * @return A Mac instance initialized with the given key. * @see Mac#getInstance(String) * @see Mac#init(Key) * @throws IllegalArgumentException * when a {@link NoSuchAlgorithmException} is caught or key is null or key is invalid. */ public static Mac getInitializedMac(final HmacAlgorithms algorithm, final byte[] key) { return getInitializedMac(algorithm.toString(), key); }