add documentation to the mapping service TELSDN-568: #close
[lispflowmapping.git] / mappingservice / implementation / src / main / java / org / opendaylight / lispflowmapping / implementation / authentication / LispAuthenticationUtil.java
1 /*
2  * Copyright (c) 2013 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 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapNotify;
11 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRegister;
12
13 public class LispAuthenticationUtil {
14
15     public static boolean validate(MapRegister mapRegister, String key) {
16         short keyId = 0;
17         if (mapRegister.getKeyId() != null) {
18             keyId = mapRegister.getKeyId();
19         }
20         ILispAuthentication authentication = LispAuthenticationFactory.getAuthentication(LispKeyIDEnum.valueOf(keyId));
21         return authentication.validate(mapRegister, key);
22     }
23
24     public static byte[] createAuthenticationData(MapNotify mapNotify, String key) {
25         ILispAuthentication authentication = LispAuthenticationFactory.getAuthentication(LispKeyIDEnum.valueOf(mapNotify.getKeyId()));
26         return authentication.getAuthenticationData(mapNotify, key);
27     }
28
29 }