Class NetI2pCryptoEdDSASupport

  • All Implemented Interfaces:
    EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>

    public class NetI2pCryptoEdDSASupport
    extends java.lang.Object
    implements EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
    • Constructor Detail

      • NetI2pCryptoEdDSASupport

        public NetI2pCryptoEdDSASupport()
    • Method Detail

      • getEDDSAPublicKeyEntryDecoder

        public PublicKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey> getEDDSAPublicKeyEntryDecoder()
        Specified by:
        getEDDSAPublicKeyEntryDecoder in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Returns:
        the public key entry decoder implementation associated with the security provider.
      • getOpenSSHEDDSAPrivateKeyEntryDecoder

        public PrivateKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder()
        Specified by:
        getOpenSSHEDDSAPrivateKeyEntryDecoder in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Returns:
        the private key entry decoder implementation associated with the security provider.
      • getEDDSASigner

        public Signature getEDDSASigner()
        Specified by:
        getEDDSASigner in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Returns:
        the signature implementation associated with the security provider.
      • getEDDSAKeySize

        public int getEDDSAKeySize​(java.security.Key key)
        Specified by:
        getEDDSAKeySize in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        key - the key to get the size of.
        Returns:
        the size of the key if it is an EdDSA key, -1 otherwise.
      • getEDDSAPublicKeyType

        public java.lang.Class<net.i2p.crypto.eddsa.EdDSAPublicKey> getEDDSAPublicKeyType()
        Specified by:
        getEDDSAPublicKeyType in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Returns:
        the public key class type associated with the security provider.
      • getEDDSAPrivateKeyType

        public java.lang.Class<net.i2p.crypto.eddsa.EdDSAPrivateKey> getEDDSAPrivateKeyType()
        Specified by:
        getEDDSAPrivateKeyType in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Returns:
        the private key class type associated with the security provider.
      • compareEDDSAPPublicKeys

        public boolean compareEDDSAPPublicKeys​(java.security.PublicKey k1,
                                               java.security.PublicKey k2)
        Specified by:
        compareEDDSAPPublicKeys in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        k1 - the first key
        k2 - the second key
        Returns:
        true if both keys are instances of the public key type associated with the security provider and they are equal.
      • compareEDDSAPrivateKeys

        public boolean compareEDDSAPrivateKeys​(java.security.PrivateKey k1,
                                               java.security.PrivateKey k2)
        Specified by:
        compareEDDSAPrivateKeys in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        k1 - the first key
        k2 - the second key
        Returns:
        true if both keys are instances of the private key type associated with the security provider and they are equal.
      • recoverEDDSAPublicKey

        public net.i2p.crypto.eddsa.EdDSAPublicKey recoverEDDSAPublicKey​(java.security.PrivateKey key)
                                                                  throws java.security.GeneralSecurityException
        Specified by:
        recoverEDDSAPublicKey in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        key - the private key
        Returns:
        the public key associated with the private key.
        Throws:
        java.security.GeneralSecurityException
      • generateEDDSAPublicKey

        public net.i2p.crypto.eddsa.EdDSAPublicKey generateEDDSAPublicKey​(byte[] seed)
                                                                   throws java.security.GeneralSecurityException
        Specified by:
        generateEDDSAPublicKey in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        seed - the raw public key bytes
        Returns:
        the associated public key
        Throws:
        java.security.GeneralSecurityException
      • generateEDDSAPrivateKey

        public net.i2p.crypto.eddsa.EdDSAPrivateKey generateEDDSAPrivateKey​(byte[] seed)
                                                                     throws java.security.GeneralSecurityException
        Specified by:
        generateEDDSAPrivateKey in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        seed - the raw private key bytes
        Returns:
        the associated private key
        Throws:
        java.security.GeneralSecurityException
      • putRawEDDSAPublicKey

        public <B extends Buffer> B putRawEDDSAPublicKey​(B buffer,
                                                         java.security.PublicKey key)
        Specified by:
        putRawEDDSAPublicKey in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Type Parameters:
        B - type of the buffer
        Parameters:
        buffer - the buffer to insert the public key into
        key - the public key to be inserted into the buffer
        Returns:
        the buffer that was passed in
      • putEDDSAKeyPair

        public <B extends Buffer> B putEDDSAKeyPair​(B buffer,
                                                    java.security.PublicKey pubKey,
                                                    java.security.PrivateKey prvKey)
        Specified by:
        putEDDSAKeyPair in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Type Parameters:
        B - type of the buffer
        Parameters:
        buffer - the buffer to insert the keys into
        pubKey - the public key to be inserted into the buffer
        prvKey - the private key to be inserted into the buffer
        Returns:
        the buffer that was passed in
      • createPublicKeySpec

        public java.security.spec.KeySpec createPublicKeySpec​(net.i2p.crypto.eddsa.EdDSAPublicKey publicKey)
        Specified by:
        createPublicKeySpec in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        publicKey - the public key
        Returns:
        a key spec from the public key
      • createPrivateKeySpec

        public java.security.spec.KeySpec createPrivateKeySpec​(net.i2p.crypto.eddsa.EdDSAPrivateKey privateKey)
        Specified by:
        createPrivateKeySpec in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        privateKey - the private key
        Returns:
        a key spec from the private key
      • getPublicKeyData

        public byte[] getPublicKeyData​(net.i2p.crypto.eddsa.EdDSAPublicKey publicKey)
        Specified by:
        getPublicKeyData in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        publicKey - the public key
        Returns:
        the raw public key bytes associated with the key
      • getPrivateKeyData

        public byte[] getPrivateKeyData​(net.i2p.crypto.eddsa.EdDSAPrivateKey privateKey)
                                 throws java.io.IOException
        Specified by:
        getPrivateKeyData in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Parameters:
        privateKey - the private key
        Returns:
        the raw private key bytes associated with the key
        Throws:
        java.io.IOException
      • getKeyFactoryAlgorithm

        public java.lang.String getKeyFactoryAlgorithm()
        Specified by:
        getKeyFactoryAlgorithm in interface EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,​net.i2p.crypto.eddsa.EdDSAPrivateKey>
        Returns:
        the algorithm name used by the provider's KeyFactory.