Package net.i2p.data

Class KeyCertificate

  • All Implemented Interfaces:
    Serializable, DataStructure

    public class KeyCertificate
    extends Certificate
    This certificate type gets its own class because it's going to be used a lot. Format is: 2 byte sig type, 2 byte crypto type, excess sig data, excess crypto data. The crypto type is assumed to be always 0x0000 (ElG) for now.
    Since:
    0.9.12
    See Also:
    Serialized Form
    • Field Detail

      • Ed25519_PAYLOAD

        static final byte[] Ed25519_PAYLOAD
        Since:
        0.9.22 pkg private for Certificate.create()
      • ECDSA256_PAYLOAD

        static final byte[] ECDSA256_PAYLOAD
        Since:
        0.9.22 pkg private for Certificate.create()
      • ELG_ECDSA256_CERT

        public static final KeyCertificate ELG_ECDSA256_CERT
        An immutable ElG/ECDSA-P256 certificate.
      • ELG_Ed25519_CERT

        public static final KeyCertificate ELG_Ed25519_CERT
        An immutable ElG/Ed25519 certificate.
        Since:
        0.9.22
    • Constructor Detail

      • KeyCertificate

        public KeyCertificate​(SigningPublicKey spk)
        A KeyCertificate with crypto type 0 (ElGamal) and the signature type and extra data from the given public key.
        Parameters:
        spk - non-null data non-null
        Throws:
        IllegalArgumentException
      • KeyCertificate

        public 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. EncType lengths greater than 256 not supported.
        Parameters:
        spk - non-null data non-null
        pk - non-null
        Throws:
        IllegalArgumentException
        Since:
        0.9.42
      • KeyCertificate

        public KeyCertificate​(SigType type)
        A KeyCertificate with crypto type 0 (ElGamal) and the signature type as specified. Payload is created. If type.getPubkeyLen() is greater than 128, caller MUST fill in the extra key data in the payload.
        Parameters:
        type - non-null
        Throws:
        IllegalArgumentException
      • KeyCertificate

        public KeyCertificate​(SigType type,
                              EncType etype)
        A KeyCertificate with crypto type and the signature type as specified. Payload is created. If type.getPubkeyLen() is greater than 128, caller MUST fill in the extra key data in the payload. EncType lengths greater than 256 not supported.
        Parameters:
        type - non-null
        etype - non-null
        Throws:
        IllegalArgumentException
        Since:
        0.9.42
    • Method Detail

      • getSigTypeCode

        public int getSigTypeCode()
        Returns:
        -1 if unset
      • getCryptoTypeCode

        public int getCryptoTypeCode()
        Returns:
        -1 if unset
      • getSigType

        public SigType getSigType()
        Returns:
        null if unset or unknown
      • getEncType

        public EncType getEncType()
        Returns:
        null if unset or unknown
        Since:
        0.9.42
      • getExtraKeyData

        public byte[] getExtraKeyData()
        Signing Key extra data, if any, is first in the array. Crypto Key extra data, if any, is second in the array, at offset max(0, getSigType().getPubkeyLen() - 128)
        Returns:
        null if unset or none
      • getExtraSigningKeyData

        public byte[] getExtraSigningKeyData()
        Signing Key extra data, if any.
        Returns:
        null if unset or none
        Throws:
        UnsupportedOperationException - if the sig type is unsupported