|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.commons.codec.digest; |
| 19 | + |
| 20 | +/** |
| 21 | + * Standard {@link HmacSHA512} algorithm names from the <cite>Java Cryptography Architecture Standard Algorithm Name |
| 22 | + * Documentation</cite>. |
| 23 | + * |
| 24 | + * <p> |
| 25 | + * <strong>Note: Not all JCE implementations supports all algorithms in this enum.</strong> |
| 26 | + * </p> |
| 27 | + * |
| 28 | + * @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html">Java Cryptography |
| 29 | + * Architecture Standard Algorithm Name Documentation</a> |
| 30 | + * @since 1.10 |
| 31 | + * @version $Id$ |
| 32 | + */ |
| 33 | +public enum HmacAlgorithms { |
| 34 | + |
| 35 | + /** |
| 36 | + * The HmacMD5 Message Authentication Code (MAC) algorithm specified in RFC 2104 and RFC 1321. |
| 37 | + * <p> |
| 38 | + * Every implementation of the Java platform is required to support this standard Mac algorithm. |
| 39 | + * </p> |
| 40 | + */ |
| 41 | + HMAC_MD5("HmacMD5"), |
| 42 | + |
| 43 | + /** |
| 44 | + * The HmacSHA1 Message Authentication Code (MAC) algorithm specified in RFC 2104 and FIPS PUB 180-2. |
| 45 | + * <p> |
| 46 | + * Every implementation of the Java platform is required to support this standard Mac algorithm. |
| 47 | + * </p> |
| 48 | + */ |
| 49 | + HMAC_SHA_1("HmacSHA1"), |
| 50 | + |
| 51 | + /** |
| 52 | + * The HmacSHA256 Message Authentication Code (MAC) algorithm specified in RFC 2104 and FIPS PUB 180-2. |
| 53 | + * <p> |
| 54 | + * Every implementation of the Java platform is required to support this standard Mac algorithm. |
| 55 | + * </p> |
| 56 | + */ |
| 57 | + HMAC_SHA_256("HmacSHA256"), |
| 58 | + |
| 59 | + /** |
| 60 | + * The HmacSHA384 Message Authentication Code (MAC) algorithm specified in RFC 2104 and FIPS PUB 180-2. |
| 61 | + * <p> |
| 62 | + * Every implementation of the Java platform is <em>not</em> required to support this Mac algorithm. |
| 63 | + * </p> |
| 64 | + */ |
| 65 | + HMAC_SHA_384("HmacSHA384"), |
| 66 | + |
| 67 | + /** |
| 68 | + * The HmacSHA512 Message Authentication Code (MAC) algorithm specified in RFC 2104 and FIPS PUB 180-2. |
| 69 | + * <p> |
| 70 | + * Every implementation of the Java platform is <em>not</em> required to support this Mac algorithm. |
| 71 | + * </p> |
| 72 | + */ |
| 73 | + HMAC_SHA_512("HmacSHA512"); |
| 74 | + |
| 75 | + private final String algorithm; |
| 76 | + |
| 77 | + private HmacAlgorithms(final String algorithm) { |
| 78 | + this.algorithm = algorithm; |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * The algorithm name |
| 83 | + * |
| 84 | + * @see <a |
| 85 | + * href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJCEProvider">Java |
| 86 | + * Cryptography Architecture Sun Providers Documentation</a> |
| 87 | + * @return The algorithm name ("HmacSHA512" for example) |
| 88 | + */ |
| 89 | + @Override |
| 90 | + public String toString() { |
| 91 | + return algorithm; |
| 92 | + } |
| 93 | + |
| 94 | +} |
0 commit comments