Package org.jose4j.keys

Examples of org.jose4j.keys.EcKeyUtil


*/
public class EcJwkGenerator
{
    public static EllipticCurveJsonWebKey generateJwk(ECParameterSpec spec) throws JoseException
    {
        EcKeyUtil keyUtil = new EcKeyUtil();
        KeyPair keyPair = keyUtil.generateKeyPair(spec);
        PublicKey publicKey = keyPair.getPublic();
        EllipticCurveJsonWebKey ecJwk = (EllipticCurveJsonWebKey) PublicJsonWebKey.Factory.newPublicJwk(publicKey);
        ecJwk.setPrivateKey(keyPair.getPrivate());
        return ecJwk;
    }
View Full Code Here


        BigInteger x = getBigIntFromBase64UrlEncodedParam(params, X_MEMBER_NAME);

        BigInteger y =  getBigIntFromBase64UrlEncodedParam(params, Y_MEMBER_NAME);

        EcKeyUtil keyUtil = new EcKeyUtil();
        key = keyUtil.publicKey(x, y, curve);
        checkForBareKeyCertMismatch();

        if (params.containsKey(PRIVATE_KEY_MEMBER_NAME))
        {
            BigInteger d = getBigIntFromBase64UrlEncodedParam(params, PRIVATE_KEY_MEMBER_NAME);
            privateKey = keyUtil.privateKey(d, curve);
        }
    }
View Full Code Here

    }

    @Override
    public boolean isAvailable()
    {
        EcKeyUtil ecKeyUtil = new EcKeyUtil();
        return ecKeyUtil.isAvailable() && AlgorithmAvailability.isAvailable("KeyAgreement", getJavaAlgorithm());
    }
View Full Code Here

TOP

Related Classes of org.jose4j.keys.EcKeyUtil

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.