net.i2p.data
Class Certificate
java.lang.Object
net.i2p.data.DataStructureImpl
net.i2p.data.Certificate
- All Implemented Interfaces:
- DataStructure, java.io.Serializable
- public class Certificate
- extends DataStructureImpl
Defines a certificate that can be attached to various I2P structures, such
as RouterIdentity and Destination, allowing routers and clients to help
manage denial of service attacks and the network utilization. Certificates
can even be defined to include identifiable information signed by some
certificate authority, though that use probably isn't appropriate for an
anonymous network ;)
- Author:
- jrandom
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
CERTIFICATE_TYPE_NULL
public static final int CERTIFICATE_TYPE_NULL
- Specifies a null certificate type with no payload
- See Also:
- Constant Field Values
CERTIFICATE_TYPE_HASHCASH
public static final int CERTIFICATE_TYPE_HASHCASH
- specifies a Hashcash style certificate
- See Also:
- Constant Field Values
Certificate
public Certificate()
Certificate
public Certificate(int type,
byte[] payload)
getCertificateType
public int getCertificateType()
setCertificateType
public void setCertificateType(int type)
getPayload
public byte[] getPayload()
setPayload
public void setPayload(byte[] payload)
readBytes
public void readBytes(java.io.InputStream in)
throws DataFormatException,
java.io.IOException
- Description copied from interface:
DataStructure
- Load up the current object with data from the given stream. Data loaded
this way must match the I2P data structure specification.
- Parameters:
in
- stream to read from
- Throws:
java.io.IOException
- if there was a problem reading the stream
DataFormatException
- if the data is improperly formatted
writeBytes
public void writeBytes(java.io.OutputStream out)
throws DataFormatException,
java.io.IOException
- Description copied from interface:
DataStructure
- Write out the data structure to the stream, using the format defined in the
I2P data structure specification.
- Parameters:
out
- stream to write to
- Throws:
DataFormatException
- if the data was incomplete or not yet ready to be written
java.io.IOException
- if there was a problem writing to the stream
writeBytes
public int writeBytes(byte[] target,
int offset)
readBytes
public int readBytes(byte[] source,
int offset)
throws DataFormatException
- Throws:
DataFormatException
size
public int size()
equals
public boolean equals(java.lang.Object object)
hashCode
public int hashCode()
toString
public java.lang.String toString()