View Javadoc

1   /*
2    * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6    * and is available at http://www.eclipse.org/legal/epl-v10.html
7    */
8   package org.opendaylight.lispflowmapping.implementation.authentication;
9   
10  public enum LispKeyIDEnum {
11      NONE(0, null), //
12      SHA1(1, "HmacSHA1"), //
13      SHA256(2, "HmacSHA256"), //
14      UNKNOWN(-1, null);
15  
16      private short keyID;
17      private String authenticationName;
18  
19      private LispKeyIDEnum(int keyID, String authenticationName) {
20          this.keyID = (short) keyID;
21          this.authenticationName = authenticationName;
22      }
23  
24      public String getAuthenticationName() {
25          return authenticationName;
26      }
27  
28      public short getKeyID() {
29          return keyID;
30      }
31  
32      public static LispKeyIDEnum valueOf(short keyID) {
33          for (LispKeyIDEnum val : values()) {
34              if (val.getKeyID() == keyID) {
35                  return val;
36              }
37          }
38          return UNKNOWN;
39      }
40  }