Search in sources :

Example 1 with ServerECDSASignatureSignerContext

use of org.keycloak.crypto.ServerECDSASignatureSignerContext in project keycloak by keycloak.

the class OAuthClient method createSigner.

public SignatureSignerContext createSigner(PrivateKey privateKey, String kid, String algorithm) {
    KeyWrapper keyWrapper = new KeyWrapper();
    keyWrapper.setAlgorithm(algorithm);
    keyWrapper.setKid(kid);
    keyWrapper.setPrivateKey(privateKey);
    SignatureSignerContext signer;
    switch(algorithm) {
        case Algorithm.ES256:
        case Algorithm.ES384:
        case Algorithm.ES512:
            signer = new ServerECDSASignatureSignerContext(keyWrapper);
            break;
        default:
            signer = new AsymmetricSignatureSignerContext(keyWrapper);
    }
    return signer;
}
Also used : KeyWrapper(org.keycloak.crypto.KeyWrapper) ServerECDSASignatureSignerContext(org.keycloak.crypto.ServerECDSASignatureSignerContext) AsymmetricSignatureSignerContext(org.keycloak.crypto.AsymmetricSignatureSignerContext) SignatureSignerContext(org.keycloak.crypto.SignatureSignerContext) ServerECDSASignatureSignerContext(org.keycloak.crypto.ServerECDSASignatureSignerContext) AsymmetricSignatureSignerContext(org.keycloak.crypto.AsymmetricSignatureSignerContext)

Aggregations

AsymmetricSignatureSignerContext (org.keycloak.crypto.AsymmetricSignatureSignerContext)1 KeyWrapper (org.keycloak.crypto.KeyWrapper)1 ServerECDSASignatureSignerContext (org.keycloak.crypto.ServerECDSASignatureSignerContext)1 SignatureSignerContext (org.keycloak.crypto.SignatureSignerContext)1