public class KeyCertificate extends Certificate
KeyCertificate specifies the encryption and signature algorithms for I2P identities:
Format Structure:
Supported Combinations:
Predefined Certificates:
Usage:
DestinationMigration Path:
Performance Considerations:
| Modifier and Type | Field and Description |
|---|---|
(package private) static byte[] | ECDSA256_PAYLOADElG + P256 |
(package private) static byte[] | Ed25519_PAYLOADElG + Ed25519 |
static KeyCertificate | ELG_ECDSA256_CERTAn immutable ElG/ECDSA-P256 certificate. |
static KeyCertificate | ELG_Ed25519_CERTAn immutable ElG/Ed25519 certificate. |
static int | HEADER_LENGTHKey certificate header length in bytes. |
static KeyCertificate | X25519_Ed25519_CERTAn immutable X25519/Ed25519 certificate. |
(package private) static byte[] | X25519_Ed25519_PAYLOADX25519 + Ed25519 |
_payload, _type, CERTIFICATE_LENGTH_SIGNED_WITH_HASH, CERTIFICATE_TYPE_HIDDEN, CERTIFICATE_TYPE_KEY, CERTIFICATE_TYPE_MULTIPLE, CERTIFICATE_TYPE_NULL, CERTIFICATE_TYPE_SIGNED, NULL_CERT| Constructor and Description |
|---|
KeyCertificate(byte[] payload)4 bytes minimum if non-null. |
KeyCertificate(Certificate cert)Up-convert a cert to this class |
KeyCertificate(SigningPublicKey spk)A KeyCertificate with crypto type 0 (ElGamal)
and the signature type and extra data from the given public key. |
KeyCertificate(SigningPublicKey spk,
PublicKey pk)A KeyCertificate with enc type from the given public key,
and the signature type and extra data from the given public key. |
KeyCertificate(SigType type)A KeyCertificate with crypto type 0 (ElGamal)
and the signature type as specified. |
KeyCertificate(SigType type,
EncType etype)A KeyCertificate with crypto type
and the signature type as specified. |
| Modifier and Type | Method and Description |
|---|---|
int | getCryptoTypeCode()Gets the crypto type code from the certificate. |
EncType | getEncType()Gets the encryption type from the certificate. |
byte[] | getExtraKeyData()Signing Key extra data, if any, is first in the array. |
byte[] | getExtraSigningKeyData()Signing Key extra data, if any. |
SigType | getSigType()Gets the signature type from the certificate. |
int | getSigTypeCode()Gets the signature type code from the certificate. |
KeyCertificate | toKeyCertificate()Returns this certificate as a KeyCertificate. |
String | toString()Returns a string representation of this KeyCertificate. |
create, create, equals, getCertificateType, getPayload, hashCode, readBytes, readBytes, setCertificateType, setPayload, size, writeBytes, writeBytescalculateHash, fromBase64, fromByteArray, read, toBase64, toByteArraystatic final byte[] ECDSA256_PAYLOAD
static final byte[] Ed25519_PAYLOAD
public static final KeyCertificate ELG_ECDSA256_CERT
public static final KeyCertificate ELG_Ed25519_CERT
public static final int HEADER_LENGTH
public static final KeyCertificate X25519_Ed25519_CERT
static final byte[] X25519_Ed25519_PAYLOAD
public KeyCertificate(byte[] payload)
throws DataFormatExceptionpayload - 4 bytes minimum if non-nullDataFormatException - if payload is too shortpublic KeyCertificate(Certificate cert) throws DataFormatException
cert - payload 4 bytes minimum if non-nullDataFormatException - if cert type != CERTIFICATE_TYPE_KEYpublic KeyCertificate(SigningPublicKey spk)
spk - non-null data non-nullIllegalArgumentException - if spk or spk data is nullpublic KeyCertificate(SigningPublicKey spk, PublicKey pk)
spk - non-null data non-nullpk - non-nullIllegalArgumentException - if spk, pk, or their data is nullpublic KeyCertificate(SigType type)
type - non-nullIllegalArgumentException - if type is nullpublic KeyCertificate(SigType type, EncType etype)
type - non-nulletype - non-nullIllegalArgumentException - if type or etype is nullpublic int getCryptoTypeCode()
public EncType getEncType()
public byte[] getExtraKeyData()
public byte[] getExtraSigningKeyData()
UnsupportedOperationException - if the sig type is unsupportedpublic SigType getSigType()
public int getSigTypeCode()
public KeyCertificate toKeyCertificate()
toKeyCertificate in class Certificatepublic String toString()
toString in class Certificate