java.lang.Object
org.snmp4j.security.UsmSecurityParameters
- All Implemented Interfaces:
BERSerializable,SecurityParameters
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]private OctetStringprivate AuthenticationProtocolprivate Integer32private OctetStringprivate Integer32private intprivate intprivate static final LogAdapterprivate static final intprivate byte[]private OctetStringprivate PrivacyProtocolprivate intprivate SecurityProtocolsprivate intprivate OctetString -
Constructor Summary
ConstructorsConstructorDescriptionUsmSecurityParameters(SecurityProtocols securityProtocols) UsmSecurityParameters(OctetString authoritativeEngineID, Integer32 authoritativeEngineBoots, Integer32 authoritativeEngineTime, OctetString userName, AuthenticationProtocol authenticationProtocol, PrivacyProtocol privacyProtocol) -
Method Summary
Modifier and TypeMethodDescriptionvoiddecodeBER(BERInputStream inputStream) Decodes aVariablefrom anInputStream.voidencodeBER(OutputStream outputStream) Encodes aVariableto anOutputStream.byte[]intbyte[]intintprivate intintReturns the length of thisBERSerializableobject in bytes when encoded according to the Basic Encoding Rules (BER).intgetBERMaxLength(int securityLevel) Gets the maximum length of the BER encoded representation of thisSecurityParametersinstance.intReturns the length of the payload of thisBERSerializableobject in bytes when encoded according to the Basic Encoding Rules (BER).intgetBERUsmPayloadLengthbyte[]intgetScopedPduPositionintGets the byte position of the first byte (counted from zero) of the security parameters in the whole message.intvoidsetAuthenticationKey(byte[] authenticationKey) voidsetAuthenticationParameters(OctetString authenticationParameters) voidsetAuthenticationProtocol(AuthenticationProtocol authenticationProtocol) voidsetAuthoritativeEngineBoots(int authoritativeEngineBoots) voidsetAuthoritativeEngineID(byte[] authoritativeEngineID) voidsetAuthoritativeEngineTime(int authoritativeEngineTime) voidsetPrivacyKey(byte[] privacyKey) voidsetPrivacyParameters(OctetString privacyParameters) voidsetPrivacyProtocol(PrivacyProtocol privacyProtocol) voidsetSecurityParametersPosition(int securityParametersPosition) Sets the position of the first byte (counted from zero) of the security parameters in the whole SNMP message.voidsetUserName(OctetString userName)
-
Field Details
-
logger
-
MAX_BER_LENGTH_WITHOU_SEC_PARAMS
private static final int MAX_BER_LENGTH_WITHOU_SEC_PARAMS- See Also:
-
authoritativeEngineID
-
authoritativeEngineBoots
-
authoritativeEngineTime
-
userName
-
authenticationProtocol
-
privacyProtocol
-
authenticationKey
private byte[] authenticationKey -
privacyKey
private byte[] privacyKey -
privacyParameters
-
authenticationParameters
-
securityParametersPosition
private int securityParametersPosition -
authParametersPosition
private int authParametersPosition -
decodedLength
private int decodedLength -
sequencePosition
private int sequencePosition -
securityProtocols
-
-
Constructor Details
-
UsmSecurityParameters
public UsmSecurityParameters() -
UsmSecurityParameters
-
UsmSecurityParameters
public UsmSecurityParameters(OctetString authoritativeEngineID, Integer32 authoritativeEngineBoots, Integer32 authoritativeEngineTime, OctetString userName, AuthenticationProtocol authenticationProtocol, PrivacyProtocol privacyProtocol)
-
-
Method Details
-
getAuthoritativeEngineID
public byte[] getAuthoritativeEngineID() -
setAuthoritativeEngineID
public void setAuthoritativeEngineID(byte[] authoritativeEngineID) -
setAuthoritativeEngineBoots
public void setAuthoritativeEngineBoots(int authoritativeEngineBoots) -
getAuthoritativeEngineBoots
public int getAuthoritativeEngineBoots() -
setAuthoritativeEngineTime
public void setAuthoritativeEngineTime(int authoritativeEngineTime) -
getAuthoritativeEngineTime
public int getAuthoritativeEngineTime() -
setUserName
-
getUserName
-
setAuthenticationProtocol
-
getAuthenticationProtocol
-
setPrivacyProtocol
-
getPrivacyProtocol
-
getBERLength
public int getBERLength()Description copied from interface:BERSerializableReturns the length of thisBERSerializableobject in bytes when encoded according to the Basic Encoding Rules (BER).- Specified by:
getBERLengthin interfaceBERSerializable- Returns:
- the BER encoded length of this variable.
-
getBERPayloadLength
public int getBERPayloadLength()Description copied from interface:BERSerializableReturns the length of the payload of thisBERSerializableobject in bytes when encoded according to the Basic Encoding Rules (BER).- Specified by:
getBERPayloadLengthin interfaceBERSerializable- Returns:
- the BER encoded length of this variable.
-
decodeBER
Description copied from interface:BERSerializableDecodes aVariablefrom anInputStream.- Specified by:
decodeBERin interfaceBERSerializable- Parameters:
inputStream- anInputStreamcontaining a BER encoded byte stream.- Throws:
IOException- if the stream could not be decoded by using BER rules.
-
getBEREncodedAuthParamsPosition
private int getBEREncodedAuthParamsPosition() -
getSequencePosition
public int getSequencePosition() -
encodeBER
Description copied from interface:BERSerializableEncodes aVariableto anOutputStream.- Specified by:
encodeBERin interfaceBERSerializable- Parameters:
outputStream- anOutputStream.- Throws:
IOException- if an error occurs while writing to the stream.
-
getBERUsmPayloadLength
public int getBERUsmPayloadLength()getBERUsmPayloadLength- Returns:
- int
-
getBERMaxLength
public int getBERMaxLength(int securityLevel) Description copied from interface:SecurityParametersGets the maximum length of the BER encoded representation of thisSecurityParametersinstance.- Specified by:
getBERMaxLengthin interfaceSecurityParameters- Parameters:
securityLevel- the security level to be used.- Returns:
- the maximum BER encoded length in bytes.
-
getAuthenticationKey
public byte[] getAuthenticationKey() -
setAuthenticationKey
public void setAuthenticationKey(byte[] authenticationKey) -
getPrivacyKey
public byte[] getPrivacyKey() -
setPrivacyKey
public void setPrivacyKey(byte[] privacyKey) -
getPrivacyParameters
-
setPrivacyParameters
-
getAuthenticationParameters
-
setAuthenticationParameters
-
getSecurityParametersPosition
public int getSecurityParametersPosition()Description copied from interface:SecurityParametersGets the byte position of the first byte (counted from zero) of the security parameters in the whole message.- Specified by:
getSecurityParametersPositionin interfaceSecurityParameters- Returns:
- the position of the first byte (counted from zero) of the security parameters in the whole SNMP message. -1 is returned, when the position is unknown (not set).
-
setSecurityParametersPosition
public void setSecurityParametersPosition(int securityParametersPosition) Description copied from interface:SecurityParametersSets the position of the first byte (counted from zero) of the security parameters in the whole SNMP message.- Specified by:
setSecurityParametersPositionin interfaceSecurityParameters- Parameters:
securityParametersPosition- an integer value greater or equal than zero.
-
getAuthParametersPosition
public int getAuthParametersPosition() -
getScopedPduPosition
public int getScopedPduPosition()getScopedPduPosition- Returns:
- int
-