All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jose4j.jws.EdDsaAlgorithm Maven / Gradle / Ivy

Go to download

The jose.4.j library is a robust and easy to use open source implementation of JSON Web Token (JWT) and the JOSE specification suite (JWS, JWE, and JWK). It is written in Java and relies solely on the JCA APIs for cryptography. Please see https://bitbucket.org/b_c/jose4j/wiki/Home for more info, examples, etc..

There is a newer version: 0.9.6
Show newest version
package org.jose4j.jws;

import org.jose4j.jwk.OctetKeyPairJsonWebKey;
import org.jose4j.jwx.KeyValidationSupport;
import org.jose4j.lang.InvalidKeyException;

import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.EdECPrivateKey;
import java.security.interfaces.EdECPublicKey;

public class EdDsaAlgorithm extends BaseSignatureAlgorithm
{
    public EdDsaAlgorithm()
    {
        super(AlgorithmIdentifiers.EDDSA, "EdDSA", OctetKeyPairJsonWebKey.KEY_TYPE);
    }

    @Override
    public void validatePrivateKey(PrivateKey privateKey) throws InvalidKeyException
    {
        KeyValidationSupport.castKey(privateKey, EdECPrivateKey.class);
    }

    @Override
    public void validatePublicKey(PublicKey publicKey) throws InvalidKeyException
    {
        KeyValidationSupport.castKey(publicKey, EdECPublicKey.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy