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 | _certificateCertificate specifying key types and metadata. |
protected int | _paddingBlocksIf compressed, the padding size / 32, else 0 |
protected PublicKey | _publicKeyPublic encryption key. |
protected SigningPublicKey | _signingKeyPublic signing key. |
| 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)Compares this KeysAndCert with another object for equality. |
Certificate | getCertificate()Certificate for this identity. |
EncType | getEncType()Encryption type from the certificate. |
Hash | getHash()Throws IllegalStateException if keys and cert are not initialized,
as of 0.9.12. |
byte[] | getPadding()Padding bytes for key alignment. |
PublicKey | getPublicKey()Valid for RouterIdentities. |
SigningPublicKey | getSigningPublicKey()Signing public key for this identity. |
SigType | getSigType()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)Reads the keys and certificate from an input stream. |
void | setCertificate(Certificate cert)Certificate to set. |
void | setPadding(byte[] padding)Padding bytes to set. |
void | setPublicKey(PublicKey key)Public key to set. |
void | setSigningPublicKey(SigningPublicKey key)Signing public key to set. |
String | toString()Returns a string representation of this KeysAndCert. |
void | writeBytes(OutputStream out)Writes the keys and certificate to an output stream. |
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 boolean equals(Object object)
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
in - 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 String toString()
public void writeBytes(OutputStream out) throws DataFormatException, IOException
out - 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)