Class AuthzClientCryptoProvider
java.lang.Object
org.keycloak.authorization.client.util.crypto.AuthzClientCryptoProvider
- All Implemented Interfaces:
CryptoProvider
Simple crypto provider to be used with the authz-client.
- Author:
- rmartinc
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateECParams
(String curveName) Create the param spec for the EC curve<T> T
getAlgorithmProvider
(Class<T> clazz, String algorithm) Get some algorithm provider implementation.Get CertificateUtils implementation.getCertStore
(CollectionCertStoreParameters collectionCertStoreParameters) getKeyFactory
(String algorithm) getKeyPairGen
(String algorithm) <T> T
getOCSPProver
(Class<T> clazz) Get PEMUtils implementation.getSecretKeyFact
(String keyAlgorithm) getSignature
(String sigAlgName) int
order()
Order of this provider.wrapFactoryForTruststore
(SSLSocketFactory delegate) Wrap given SSLSocketFactory and decorate it with some additional functionality.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.common.crypto.CryptoProvider
getSupportedKeyStoreTypes, getSupportedRsaKeySizes
-
Constructor Details
-
AuthzClientCryptoProvider
public AuthzClientCryptoProvider()
-
-
Method Details
-
getBouncyCastleProvider
- Specified by:
getBouncyCastleProvider
in interfaceCryptoProvider
- Returns:
- BouncyCastle security provider. Can be either non-FIPS or FIPS based provider
-
order
public int order()Description copied from interface:CryptoProvider
Order of this provider. This allows to specify which CryptoProvider will have preference in case that more of them are on the classpath. The higher number has preference over the lower number- Specified by:
order
in interfaceCryptoProvider
-
getAlgorithmProvider
Description copied from interface:CryptoProvider
Get some algorithm provider implementation. Returned implementation can be dependent according to if we have non-fips bouncycastle or fips bouncycastle on the classpath.- Specified by:
getAlgorithmProvider
in interfaceCryptoProvider
- Parameters:
clazz
- Returned class.algorithm
- Type of the algorithm, which we want to return- Returns:
-
getCertificateUtils
Description copied from interface:CryptoProvider
Get CertificateUtils implementation. Returned implementation can be dependent according to if we have non-fips bouncycastle or fips bouncycastle on the classpath.- Specified by:
getCertificateUtils
in interfaceCryptoProvider
- Returns:
-
getPemUtils
Description copied from interface:CryptoProvider
Get PEMUtils implementation. Returned implementation can be dependent according to if we have non-fips bouncycastle or fips bouncycastle on the classpath.- Specified by:
getPemUtils
in interfaceCryptoProvider
- Returns:
-
getOCSPProver
- Specified by:
getOCSPProver
in interfaceCryptoProvider
-
getIdentityExtractorProvider
- Specified by:
getIdentityExtractorProvider
in interfaceCryptoProvider
-
getEcdsaCryptoProvider
- Specified by:
getEcdsaCryptoProvider
in interfaceCryptoProvider
-
createECParams
Description copied from interface:CryptoProvider
Create the param spec for the EC curve- Specified by:
createECParams
in interfaceCryptoProvider
- Returns:
-
getKeyPairGen
public KeyPairGenerator getKeyPairGen(String algorithm) throws NoSuchAlgorithmException, NoSuchProviderException - Specified by:
getKeyPairGen
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
-
getKeyFactory
public KeyFactory getKeyFactory(String algorithm) throws NoSuchAlgorithmException, NoSuchProviderException - Specified by:
getKeyFactory
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
-
getAesCbcCipher
public Cipher getAesCbcCipher() throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException- Specified by:
getAesCbcCipher
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
NoSuchPaddingException
-
getAesGcmCipher
public Cipher getAesGcmCipher() throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException- Specified by:
getAesGcmCipher
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
NoSuchPaddingException
-
getSecretKeyFact
public SecretKeyFactory getSecretKeyFact(String keyAlgorithm) throws NoSuchAlgorithmException, NoSuchProviderException - Specified by:
getSecretKeyFact
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
-
getKeyStore
public KeyStore getKeyStore(KeystoreUtil.KeystoreFormat format) throws KeyStoreException, NoSuchProviderException - Specified by:
getKeyStore
in interfaceCryptoProvider
- Throws:
KeyStoreException
NoSuchProviderException
-
getX509CertFactory
- Specified by:
getX509CertFactory
in interfaceCryptoProvider
- Throws:
CertificateException
NoSuchProviderException
-
getCertStore
public CertStore getCertStore(CollectionCertStoreParameters collectionCertStoreParameters) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException - Specified by:
getCertStore
in interfaceCryptoProvider
- Throws:
InvalidAlgorithmParameterException
NoSuchAlgorithmException
NoSuchProviderException
-
getCertPathBuilder
public CertPathBuilder getCertPathBuilder() throws NoSuchAlgorithmException, NoSuchProviderException- Specified by:
getCertPathBuilder
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
-
getSignature
public Signature getSignature(String sigAlgName) throws NoSuchAlgorithmException, NoSuchProviderException - Specified by:
getSignature
in interfaceCryptoProvider
- Throws:
NoSuchAlgorithmException
NoSuchProviderException
-
wrapFactoryForTruststore
Description copied from interface:CryptoProvider
Wrap given SSLSocketFactory and decorate it with some additional functionality. This method is used in the context of truststore (where Keycloak is SSL client)- Specified by:
wrapFactoryForTruststore
in interfaceCryptoProvider
- Parameters:
delegate
- The original factory to wrap. Usually default java SSLSocketFactory- Returns:
- decorated factory
-