Search in sources :

Example 1 with Curve

use of com.nimbusds.jose.jwk.Curve in project dhis2-core by dhis2.

the class Jwks method generateEc.

public static ECKey generateEc() {
    KeyPair keyPair = KeyGeneratorUtils.generateEcKey();
    ECPublicKey publicKey = (ECPublicKey) keyPair.getPublic();
    ECPrivateKey privateKey = (ECPrivateKey) keyPair.getPrivate();
    Curve curve = Curve.forECParameterSpec(publicKey.getParams());
    // @formatter:off
    return new ECKey.Builder(curve, publicKey).privateKey(privateKey).keyID(UUID.randomUUID().toString()).build();
// @formatter:on
}
Also used : ECPrivateKey(java.security.interfaces.ECPrivateKey) KeyPair(java.security.KeyPair) ECPublicKey(java.security.interfaces.ECPublicKey) Curve(com.nimbusds.jose.jwk.Curve) ECKey(com.nimbusds.jose.jwk.ECKey)

Aggregations

Curve (com.nimbusds.jose.jwk.Curve)1 ECKey (com.nimbusds.jose.jwk.ECKey)1 KeyPair (java.security.KeyPair)1 ECPrivateKey (java.security.interfaces.ECPrivateKey)1 ECPublicKey (java.security.interfaces.ECPublicKey)1