Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jmx/snmp/SnmpUsmKeyHandler.java
38924 views
/*1* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package com.sun.jmx.snmp;2526/**27* This interface allows you to compute key localization and delta generation. It is useful when adding user in USM MIB. An instance of <CODE> SnmpUsmKeyHandler </CODE> is associated to each <CODE> SnmpEngine </CODE> object.28* When computing key, an authentication algorithm is needed. The supported ones are : usmHMACMD5AuthProtocol and usmHMACSHAAuthProtocol.29* <p><b>This API is a Sun Microsystems internal API and is subject30* to change without notice.</b></p>31* @since 1.532*/33public interface SnmpUsmKeyHandler {3435/**36* DES privacy algorithm key size. To be used when localizing privacy key37*/38public static int DES_KEY_SIZE = 16;3940/**41* DES privacy algorithm delta size. To be used when calculing privacy key delta.42*/43public static int DES_DELTA_SIZE = 16;4445/**46* Translate a password to a key. It MUST be compliant to RFC 2574 description.47* @param algoName The authentication algorithm to use.48* @param password Password to convert.49* @return The key.50* @exception IllegalArgumentException If the algorithm is unknown.51*/52public byte[] password_to_key(String algoName, String password) throws IllegalArgumentException;53/**54* Localize the passed key using the passed <CODE>SnmpEngineId</CODE>. It MUST be compliant to RFC 2574 description.55* @param algoName The authentication algorithm to use.56* @param key The key to localize;57* @param engineId The Id used to localize the key.58* @return The localized key.59* @exception IllegalArgumentException If the algorithm is unknown.60*/61public byte[] localizeAuthKey(String algoName, byte[] key, SnmpEngineId engineId) throws IllegalArgumentException;6263/**64* Localize the passed privacy key using the passed <CODE>SnmpEngineId</CODE>. It MUST be compliant to RFC 2574 description.65* @param algoName The authentication algorithm to use.66* @param key The key to localize;67* @param engineId The Id used to localize the key.68* @param keysize The privacy algorithm key size.69* @return The localized key.70* @exception IllegalArgumentException If the algorithm is unknown.71*/72public byte[] localizePrivKey(String algoName, byte[] key, SnmpEngineId engineId,int keysize) throws IllegalArgumentException;7374/**75* Calculate the delta parameter needed when processing key change. This computation is done by the key change initiator. It MUST be compliant to RFC 2574 description.76* @param algoName The authentication algorithm to use.77* @param oldKey The old key.78* @param newKey The new key.79* @param random The random value.80* @return The delta.81* @exception IllegalArgumentException If the algorithm is unknown.82*/83public byte[] calculateAuthDelta(String algoName, byte[] oldKey, byte[] newKey, byte[] random) throws IllegalArgumentException;8485/**86* Calculate the delta parameter needed when processing key change for a privacy algorithm. This computation is done by the key change initiator. It MUST be compliant to RFC 2574 description.87* @param algoName The authentication algorithm to use.88* @param oldKey The old key.89* @param newKey The new key.90* @param random The random value.91* @param deltaSize The algo delta size.92* @return The delta.93* @exception IllegalArgumentException If the algorithm is unknown.94*/95public byte[] calculatePrivDelta(String algoName, byte[] oldKey, byte[] newKey, byte[] random, int deltaSize) throws IllegalArgumentException;9697}9899100