public abstract class AuthGeneric extends Object implements AuthenticationProtocol
| Constructor and Description |
|---|
AuthGeneric(String protoName,
int digestLength)
Creates an authentication protocol with the specified name (ID) and digest length and using the
DEFAULT_AUTHENTICATION_CODE_LENGTH default code length. |
AuthGeneric(String protoName,
int digestLength,
int authenticationCodeLength)
Creates an authentication protocol with the specified name (ID) and digest length and using the
DEFAULT_AUTHENTICATION_CODE_LENGTH default code length. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
authenticate(byte[] authenticationKey,
byte[] message,
int messageOffset,
int messageLength,
ByteArrayWindow digest)
Authenticates an outgoing message.
|
byte[] |
changeDelta(byte[] oldKey,
byte[] newKey,
byte[] random)
Computes the delta digest needed to remotely change an user's
authenitcation key.
|
int |
getAuthenticationCodeLength()
The length of the authentication code (the hashing output length) in octets.
|
int |
getDigestLength()
Gets the length of the message digest used by this authentication protocol.
|
protected MessageDigest |
getDigestObject()
Get a fresh MessageDigest object of the Algorithm specified in the
constructor.
|
byte[] |
hash(byte[] data)
Generates a hash value for the given data.
|
byte[] |
hash(byte[] data,
int offset,
int length)
Generates a hash value for the given data.
|
boolean |
isAuthentic(byte[] authenticationKey,
byte[] message,
int messageOffset,
int messageLength,
ByteArrayWindow digest)
Authenticates an incoming message.
|
byte[] |
passwordToKey(OctetString passwordString,
byte[] engineID)
Generates the localized key for the given password and engine id.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIDpublic AuthGeneric(String protoName, int digestLength)
DEFAULT_AUTHENTICATION_CODE_LENGTH default code length.protoName - the name (ID) of the authentication protocol. Only names that are supported by the used
security provider can be used.digestLength - the digest length.public AuthGeneric(String protoName, int digestLength, int authenticationCodeLength)
DEFAULT_AUTHENTICATION_CODE_LENGTH default code length.protoName - the name (ID) of the authentication protocol. Only names that are supported by the used
security provider can be used.digestLength - the digest length.authenticationCodeLength - the length of the hash output (i.e., the authentication code length).public int getDigestLength()
getDigestLength in interface AuthenticationProtocolpublic int getAuthenticationCodeLength()
getAuthenticationCodeLength in interface AuthenticationProtocolprotected MessageDigest getDigestObject()
public boolean authenticate(byte[] authenticationKey,
byte[] message,
int messageOffset,
int messageLength,
ByteArrayWindow digest)
AuthenticationProtocoldigestOffset offset is pointing
inside the message buffer and must be zeroed before the authentication
value is computed.authenticate in interface AuthenticationProtocolauthenticationKey - the authentication key to be used for authenticating the message.message - the entire message for which the digest should be determined.messageOffset - the offset in message where the message actually starts.messageLength - the actual message length (may be smaller than
message.length).digest - the offset in message where to store the digest.true if the message digest has been successfully computed
and set, false otherwise.public boolean isAuthentic(byte[] authenticationKey,
byte[] message,
int messageOffset,
int messageLength,
ByteArrayWindow digest)
AuthenticationProtocolisAuthentic in interface AuthenticationProtocolauthenticationKey - the authentication key to be used for authenticating the message.message - the entire message for which the digest should be determined.messageOffset - the offset in message where the message actually starts.messageLength - the actual message length (may be smaller than
message.length).digest - the digest of the message.true if the message is authentic, false
otherwise.public byte[] changeDelta(byte[] oldKey,
byte[] newKey,
byte[] random)
AuthenticationProtocolchangeDelta in interface AuthenticationProtocololdKey - the old authentication/privacy key.newKey - the new authentication/privacy key.random - the random 'seed' to be used to produce the digest.random array.public byte[] passwordToKey(OctetString passwordString, byte[] engineID)
AuthenticationProtocolpasswordToKey in interface AuthenticationProtocolpasswordString - the authentication pass phrase.engineID - the engine ID of the authoritative engine.public byte[] hash(byte[] data)
AuthenticationProtocolhash in interface AuthenticationProtocoldata - the datapublic byte[] hash(byte[] data,
int offset,
int length)
AuthenticationProtocolhash in interface AuthenticationProtocoldata - the dataoffset - offset into datalength - length of data to hashCopyright © 2016 SNMP4J.org. All Rights Reserved.