org.apache.directory.server.kerberos.shared.messages.value
Class Checksum

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.server.kerberos.shared.messages.value.Checksum
All Implemented Interfaces:
org.apache.directory.shared.asn1.Asn1Object

public class Checksum
extends org.apache.directory.shared.asn1.AbstractAsn1Object

The Checksum structure is used to store a checksum associated to a type. The ASN.1 grammar is : Checksum ::= SEQUENCE { cksumtype [0] Int32, checksum [1] OCTET STRING }

Version:
$Rev: 902575 $, $Date: 2010-01-24 15:38:06 +0100 (Sun, 24 Jan 2010) $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
Checksum()
          Creates a new instance of Checksum.
Checksum(ChecksumType cksumtype, byte[] checksum)
          Creates a new instance of Checksum.
 
Method Summary
 int computeLength()
          Compute the checksum length Checksum : 0x30 L1 checksum sequence | +--> 0xA0 L2 cksumtype tag | | | +--> 0x02 L2-1 cksumtype (int) | +--> 0xA1 L3 checksum tag | +--> 0x04 L3-1 checksum (OCTET STRING) where L1 = L2 + lenght(0xA0) + length(L2) + L3 + lenght(0xA1) + length(L3) and L2 = L2-1 + length(0x02) + length( L2-1) L3 = L3-1 + length(0x04) + length( L3-1)
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the Checksum message to a PDU.
 boolean equals(java.lang.Object o)
           
 ChecksumType getChecksumType()
          Returns the ChecksumType.
 byte[] getChecksumValue()
          Returns the checksum value.
 void setChecksumType(ChecksumType cksumType)
          Set the ChecksumType.
 void setChecksumValue(byte[] checksum)
          Set the checksum Value.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String tabs)
           
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Checksum

public Checksum()
Creates a new instance of Checksum.


Checksum

public Checksum(ChecksumType cksumtype,
                byte[] checksum)
Creates a new instance of Checksum.

Parameters:
cksumtype - The checksum type used
checksum - The checksum value
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

getChecksumValue

public byte[] getChecksumValue()
Returns the checksum value.

Returns:
The checksum value.

setChecksumValue

public void setChecksumValue(byte[] checksum)
Set the checksum Value.

Parameters:
checksum - The checksum value

getChecksumType

public ChecksumType getChecksumType()
Returns the ChecksumType.

Returns:
The ChecksumType.

setChecksumType

public void setChecksumType(ChecksumType cksumType)
Set the ChecksumType.

Parameters:
cksumType - The checksum algorithm used

computeLength

public int computeLength()
Compute the checksum length Checksum : 0x30 L1 checksum sequence | +--> 0xA0 L2 cksumtype tag | | | +--> 0x02 L2-1 cksumtype (int) | +--> 0xA1 L3 checksum tag | +--> 0x04 L3-1 checksum (OCTET STRING) where L1 = L2 + lenght(0xA0) + length(L2) + L3 + lenght(0xA1) + length(L3) and L2 = L2-1 + length(0x02) + length( L2-1) L3 = L3-1 + length(0x04) + length( L3-1)

Specified by:
computeLength in interface org.apache.directory.shared.asn1.Asn1Object
Specified by:
computeLength in class org.apache.directory.shared.asn1.AbstractAsn1Object

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws org.apache.directory.shared.asn1.codec.EncoderException
Encode the Checksum message to a PDU. Checksum : 0x30 LL 0xA0 LL 0x02 0x01 cksumtype 0xA1 LL 0x04 LL Checksum

Specified by:
encode in interface org.apache.directory.shared.asn1.Asn1Object
Overrides:
encode in class org.apache.directory.shared.asn1.AbstractAsn1Object
Parameters:
buffer - The buffer where to put the PDU. It should have been allocated before, with the right size.
Returns:
The constructed PDU.
Throws:
org.apache.directory.shared.asn1.codec.EncoderException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toString

public java.lang.String toString(java.lang.String tabs)
See Also:
Object.toString()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.