DataStructureKeyCertificatepublic class Certificate extends DataStructureImpl
| 修飾子とタイプ | フィールド | 説明 |
|---|---|---|
protected byte[] |
_payload |
|
protected int |
_type |
|
static int |
CERTIFICATE_LENGTH_SIGNED_WITH_HASH |
|
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_KEY |
|
static int |
CERTIFICATE_TYPE_MULTIPLE |
Contains multiple certs
|
static int |
CERTIFICATE_TYPE_NULL |
Specifies a null certificate type with no payload
|
static int |
CERTIFICATE_TYPE_SIGNED |
Signed with 40-byte Signature and (optional) 32-byte hash
|
static Certificate |
NULL_CERT |
| コンストラクタ | 説明 |
|---|---|
Certificate() |
|
Certificate(int type,
byte[] payload) |
| 修飾子とタイプ | メソッド | 説明 |
|---|---|---|
static Certificate |
create(byte[] data,
int off) |
If null, P256 key, or Ed25519 key cert, return immutable static instance, else create new
|
static Certificate |
create(java.io.InputStream in) |
If null, P256 key, or Ed25519 key cert, return immutable static instance, else create new
|
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() |
|
KeyCertificate |
toKeyCertificate() |
Up-convert this to a KeyCertificate
|
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.
|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArraypublic static final Certificate NULL_CERT
protected int _type
protected byte[] _payload
public static final int CERTIFICATE_TYPE_NULL
public static final int CERTIFICATE_TYPE_HASHCASH
public static final int CERTIFICATE_TYPE_HIDDEN
public static final int CERTIFICATE_TYPE_SIGNED
public static final int CERTIFICATE_LENGTH_SIGNED_WITH_HASH
public static final int CERTIFICATE_TYPE_MULTIPLE
public static final int CERTIFICATE_TYPE_KEY
public Certificate()
public Certificate(int type,
byte[] payload)
java.lang.IllegalArgumentException - if type < 0public static Certificate create(byte[] data, int off) throws DataFormatException
DataFormatException - if not enough bytespublic static Certificate create(java.io.InputStream in) throws DataFormatException, java.io.IOException
DataFormatExceptionjava.io.IOExceptionpublic int getCertificateType()
public void setCertificateType(int type)
java.lang.IllegalArgumentException - if type < 0java.lang.IllegalStateException - if already setpublic byte[] getPayload()
public void setPayload(byte[] payload)
java.lang.IllegalStateException - if already setpublic void readBytes(java.io.InputStream in)
throws DataFormatException,
java.io.IOException
DataStructurein - stream to read fromjava.lang.IllegalStateException - if already setDataFormatException - if the data is improperly formattedjava.io.IOException - if there was a problem reading the streampublic void writeBytes(java.io.OutputStream out)
throws DataFormatException,
java.io.IOException
DataStructureout - stream to write toDataFormatException - if the data was incomplete or not yet ready to be writtenjava.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
java.lang.IllegalStateException - if already setDataFormatExceptionpublic int size()
public KeyCertificate toKeyCertificate() throws DataFormatException
DataFormatException - if cert type != CERTIFICATE_TYPE_KEYpublic boolean equals(java.lang.Object object)
equals クラス内 java.lang.Objectpublic int hashCode()
hashCode クラス内 java.lang.Objectpublic java.lang.String toString()
toString クラス内 java.lang.Object