|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.data.DataStructureImpl
net.i2p.data.Certificate
public class Certificate
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 ;)
Field Summary | |
---|---|
static int |
CERTIFICATE_TYPE_HASHCASH
specifies a Hashcash style certificate |
static int |
CERTIFICATE_TYPE_HIDDEN
we should not be used for anything (don't use us in the netDb, in tunnels, or tell others about us) |
static int |
CERTIFICATE_TYPE_NULL
Specifies a null certificate type with no payload |
Constructor Summary | |
---|---|
Certificate()
|
|
Certificate(int type,
byte[] payload)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object object)
|
int |
getCertificateType()
|
byte[] |
getPayload()
|
int |
hashCode()
|
int |
readBytes(byte[] source,
int offset)
|
void |
readBytes(java.io.InputStream in)
Load up the current object with data from the given stream. |
void |
setCertificateType(int type)
|
void |
setPayload(byte[] payload)
|
int |
size()
|
java.lang.String |
toString()
|
int |
writeBytes(byte[] target,
int offset)
|
void |
writeBytes(java.io.OutputStream out)
Write out the data structure to the stream, using the format defined in the I2P data structure specification. |
Methods inherited from class net.i2p.data.DataStructureImpl |
---|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CERTIFICATE_TYPE_NULL
public static final int CERTIFICATE_TYPE_HASHCASH
public static final int CERTIFICATE_TYPE_HIDDEN
Constructor Detail |
---|
public Certificate()
public Certificate(int type, byte[] payload)
Method Detail |
---|
public int getCertificateType()
public void setCertificateType(int type)
public byte[] getPayload()
public void setPayload(byte[] payload)
public void readBytes(java.io.InputStream in) throws DataFormatException, java.io.IOException
DataStructure
in
- stream to read from
DataFormatException
- if the data is improperly formatted
java.io.IOException
- if there was a problem reading the streampublic void writeBytes(java.io.OutputStream out) throws DataFormatException, java.io.IOException
DataStructure
out
- stream to write to
DataFormatException
- if the data was incomplete or not yet ready to be written
java.io.IOException
- if there was a problem writing to the streampublic int writeBytes(byte[] target, int offset)
public int readBytes(byte[] source, int offset) throws DataFormatException
DataFormatException
public int size()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |