|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.snmp4j.security.AuthGeneric
public abstract class AuthGeneric
The abstract class AuthGeneric implements common operations for SNMP authentication protocols, such as MD5 and SHA.
Field Summary |
---|
Fields inherited from interface org.snmp4j.security.AuthenticationProtocol |
---|
MESSAGE_AUTHENTICATION_CODE_LENGTH |
Constructor Summary | |
---|---|
AuthGeneric(java.lang.String protoName,
int digestLength)
|
Method Summary | |
---|---|
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 |
getDigestLength()
Gets the length of the digest generated by this authentication protocol. |
protected java.security.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.snmp4j.security.AuthenticationProtocol |
---|
getID |
Constructor Detail |
---|
public AuthGeneric(java.lang.String protoName, int digestLength)
Method Detail |
---|
public int getDigestLength()
AuthenticationProtocol
getDigestLength
in interface AuthenticationProtocol
protected java.security.MessageDigest getDigestObject()
public boolean authenticate(byte[] authenticationKey, byte[] message, int messageOffset, int messageLength, ByteArrayWindow digest)
AuthenticationProtocol
digestOffset
offset is pointing
inside the message buffer and must be zeroed before the authentication
value is computed.
authenticate
in interface AuthenticationProtocol
authenticationKey
- 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)
AuthenticationProtocol
isAuthentic
in interface AuthenticationProtocol
authenticationKey
- 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)
AuthenticationProtocol
changeDelta
in interface AuthenticationProtocol
oldKey
- 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)
AuthenticationProtocol
passwordToKey
in interface AuthenticationProtocol
passwordString
- the authentication pass phrase.engineID
- the engine ID of the authoritative engine.
public byte[] hash(byte[] data)
AuthenticationProtocol
hash
in interface AuthenticationProtocol
data
- the data
public byte[] hash(byte[] data, int offset, int length)
AuthenticationProtocol
hash
in interface AuthenticationProtocol
data
- the dataoffset
- offset into datalength
- length of data to hash
|
Copyright 2005-2010 Frank Fock (SNMP4J.org) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |