java.lang.Object
net.i2p.data.DataStructureImpl
net.i2p.data.KeysAndCert
net.i2p.data.router.RouterIdentity
- All Implemented Interfaces:
Serializable, DataStructure
Defines the unique identifier of a router, including any certificate or public key.
As of 0.9.9 this data structure is immutable after the two keys and the certificate are set; attempts to change them will throw an IllegalStateException.
- See Also:
Field Summary
Fields inherited from class KeysAndCert
_certificate, _paddingBlocks, _publicKey, _signingKeyModifier and TypeFieldDescriptionprotected CertificateCertificate specifying key types and metadata.protected intIf compressed, the padding size / 32, else 0.protected PublicKeyPublic encryption key.protected SigningPublicKeyPublic signing key.Constructor Summary
ConstructorsConstructorDescriptionBoth keys and the certificate are inherited fromKeysAndCertand stay null until readBytes() or a subclass sets them, so a fresh identity carries no identity yet.Method Summary
All MethodsModifier and TypeMethodDescriptionbooleanCompares this KeysAndCert with another object for equality.inthashCode()The signing key has enough randomness in it to use it by itself for speed.booleanisHidden()This router specified that they should not be used as a part of a tunnel, nor queried for the netDb, and that disclosure of their contact information should be limited.Methods inherited from class KeysAndCert
calculateHash, combinePadding, getCertificate, getEncType, getHash, getPadding, getPublicKey, getSigningPublicKey, getSigType, isCompressible, readBytes, setCertificate, setPadding, setPublicKey, setSigningPublicKey, toString, writeBytes, writePaddingBytesModifier and TypeMethodDescriptionThrows 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.Certificate for this identity.Encryption type from the certificate.getHash()Throws IllegalStateException if keys and cert are not initialized, as of 0.9.12.byte[]Padding bytes for key alignment.Valid for RouterIdentities.Signing public key for this identity.Signature type from the certificate.booleanIs there compressible padding?voidreadBytes(InputStream in) Reads the keys and certificate from an input stream.voidsetCertificate(Certificate cert) Certificate to set.voidsetPadding(byte[] padding) Padding bytes to set.voidsetPublicKey(PublicKey key) Public key to set.voidSigning public key to set.toString()Returns a string representation of this KeysAndCert.voidwriteBytes(OutputStream out) Writes the keys and certificate to an output stream.protected intwritePaddingBytes(byte[] target, int off) ForDestination.writeBytes().Methods inherited from class DataStructureImpl
fromBase64, fromByteArray, read, toBase64, toByteArrayModifier and TypeMethodDescriptionvoidfromBase64(String data) Load the structure from the provided base64 string.voidfromByteArray(byte[] data) Loads structure from the data providedprotected intread(InputStream in, byte[] target) Repeated reads until buffer is full or IOException is thrown.toBase64()Render the structure into modified base 64 notation.byte[]Convert the structure to a byte array.
Constructor Details
RouterIdentity
public RouterIdentity()Both keys and the certificate are inherited fromKeysAndCertand stay null until readBytes() or a subclass sets them, so a fresh identity carries no identity yet.
Method Details
isHidden
public boolean isHidden()This router specified that they should not be used as a part of a tunnel, nor queried for the netDb, and that disclosure of their contact information should be limited.This is ONLY if the certificate is a hidden type. Hidden mode may also be specified with a capability in the RouterInfo.
Not recommended for direct use. Use of
RouterInfo.isHidden()(which calls this) is preferred.- Returns:
- true if the certificate type limits this router's reachability
equals
Description copied from class:KeysAndCertCompares this KeysAndCert with another object for equality.- Overrides:
equalsin classKeysAndCert
hashCode
public int hashCode()Description copied from class:KeysAndCertThe signing key has enough randomness in it to use it by itself for speed.- Overrides:
hashCodein classKeysAndCert