public class KeysAndCert extends DataStructureImpl
KeysAndCert provides the fundamental cryptographic identity components:
Structure:
Usage:
Destination and RouterIdentityKey Types:
Immutability:
IllegalStateExceptionHistory:
| Modifier and Type | Field and Description |
|---|---|
protected Certificate |
_certificate |
protected int |
_paddingBlocks
If compressed, the padding size / 32, else 0
|
protected PublicKey |
_publicKey |
protected SigningPublicKey |
_signingKey |
| Constructor and Description |
|---|
KeysAndCert() |
| Modifier and Type | Method and Description |
|---|---|
Hash |
calculateHash()
Throws IllegalStateException if keys and cert are not initialized,
as of 0.9.12.
|
protected static byte[] |
combinePadding(byte[] pad1,
byte[] pad2)
Combines two padding arrays.
|
boolean |
equals(Object object) |
Certificate |
getCertificate() |
EncType |
getEncType()
Gets the encryption type from the certificate.
|
Hash |
getHash()
Throws IllegalStateException if keys and cert are not initialized,
as of 0.9.12.
|
byte[] |
getPadding()
Gets the padding bytes.
|
PublicKey |
getPublicKey()
Valid for RouterIdentities.
|
SigningPublicKey |
getSigningPublicKey() |
SigType |
getSigType()
Gets the signature type from the certificate.
|
int |
hashCode()
the signing key has enough randomness in it to use it by itself for speed
|
boolean |
isCompressible()
Is there compressible padding?
|
void |
readBytes(InputStream in)
Load up the current object with data from the given stream.
|
void |
setCertificate(Certificate cert)
Sets the certificate.
|
void |
setPadding(byte[] padding)
Sets the padding bytes.
|
void |
setPublicKey(PublicKey key)
Sets the public key.
|
void |
setSigningPublicKey(SigningPublicKey key)
Sets the signing public key.
|
String |
toString() |
void |
writeBytes(OutputStream out)
Write out the data structure to the stream, using the format defined in the
I2P data structure specification.
|
protected int |
writePaddingBytes(byte[] target,
int off)
For Destination.writeBytes()
|
fromBase64, fromByteArray, read, toBase64, toByteArrayprotected Certificate _certificate
protected int _paddingBlocks
protected PublicKey _publicKey
protected SigningPublicKey _signingKey
public Hash calculateHash()
calculateHash in interface DataStructurecalculateHash in class DataStructureImplIllegalStateException - if keys and cert are not initializedprotected static byte[] combinePadding(byte[] pad1,
byte[] pad2)
public Certificate getCertificate()
public EncType getEncType()
public Hash getHash()
IllegalStateException - if keys and cert are not initializedpublic byte[] getPadding()
public PublicKey getPublicKey()
public SigningPublicKey getSigningPublicKey()
public SigType getSigType()
public int hashCode()
public boolean isCompressible()
public void readBytes(InputStream in) throws DataFormatException, IOException
DataStructurein - stream to read fromIllegalStateException - if data already setDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic void setCertificate(Certificate cert)
IllegalStateException - if was already setpublic void setPadding(byte[] padding)
IllegalStateException - if was already setpublic void setPublicKey(PublicKey key)
IllegalStateException - if was already setpublic void setSigningPublicKey(SigningPublicKey key)
IllegalStateException - if was already setpublic void writeBytes(OutputStream out) throws DataFormatException, IOException
DataStructureout - stream to write toDataFormatException - if the data was incomplete or not yet ready to be writtenIOException - if there was a problem writing to the streamprotected int writePaddingBytes(byte[] target,
int off)