org.jose4j.jws.EdDsaAlgorithm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jose4j Show documentation
Show all versions of jose4j Show documentation
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..
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);
}
}