Package io.jans.as.model.crypto
Class AbstractCryptoProvider
- java.lang.Object
-
- io.jans.as.model.crypto.AbstractCryptoProvider
-
- Direct Known Subclasses:
AuthCryptoProvider
,ElevenCryptoProvider
public abstract class AbstractCryptoProvider extends java.lang.Object
- Version:
- October 26, 2021
- Author:
- Javier Rojas Blum, Sergey Manoylo
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.log4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description AbstractCryptoProvider()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkKeyExpiration(java.lang.String alias, java.lang.Long expirationTime)
abstract boolean
containsKey(java.lang.String keyId)
abstract boolean
deleteKey(java.lang.String keyId)
static org.json.JSONObject
generateJwks(AbstractCryptoProvider cryptoProvider, AppConfiguration configuration)
abstract org.json.JSONObject
generateKey(Algorithm algorithm, java.lang.Long expirationTime)
abstract org.json.JSONObject
generateKey(Algorithm algorithm, java.lang.Long expirationTime, int keyLength)
io.jans.eleven.model.JwksRequestParam
getJwksRequestParam(org.json.JSONObject jwkJsonObject)
java.lang.String
getKeyId(JSONWebKeySet jsonWebKeySet, Algorithm algorithm, Use use)
int
getKeyRegenerationIntervalInDays()
java.util.List<java.lang.String>
getKeys()
abstract java.security.PrivateKey
getPrivateKey(java.lang.String keyId)
abstract java.security.PublicKey
getPublicKey(java.lang.String alias)
java.security.PublicKey
getPublicKey(java.lang.String alias, org.json.JSONObject jwks, Algorithm requestedAlgorithm)
void
setKeyRegenerationIntervalInDays(int keyRegenerationIntervalInDays)
abstract java.lang.String
sign(java.lang.String signingInput, java.lang.String keyId, java.lang.String sharedSecret, SignatureAlgorithm signatureAlgorithm)
abstract boolean
verifySignature(java.lang.String signingInput, java.lang.String encodedSignature, java.lang.String keyId, org.json.JSONObject jwks, java.lang.String sharedSecret, SignatureAlgorithm signatureAlgorithm)
-
-
-
Method Detail
-
generateKey
public abstract org.json.JSONObject generateKey(Algorithm algorithm, java.lang.Long expirationTime) throws CryptoProviderException
- Throws:
CryptoProviderException
-
generateKey
public abstract org.json.JSONObject generateKey(Algorithm algorithm, java.lang.Long expirationTime, int keyLength) throws CryptoProviderException
- Throws:
CryptoProviderException
-
sign
public abstract java.lang.String sign(java.lang.String signingInput, java.lang.String keyId, java.lang.String sharedSecret, SignatureAlgorithm signatureAlgorithm) throws CryptoProviderException
- Throws:
CryptoProviderException
-
verifySignature
public abstract boolean verifySignature(java.lang.String signingInput, java.lang.String encodedSignature, java.lang.String keyId, org.json.JSONObject jwks, java.lang.String sharedSecret, SignatureAlgorithm signatureAlgorithm) throws CryptoProviderException
- Throws:
CryptoProviderException
-
deleteKey
public abstract boolean deleteKey(java.lang.String keyId) throws CryptoProviderException
- Throws:
CryptoProviderException
-
containsKey
public abstract boolean containsKey(java.lang.String keyId)
-
getKeys
public java.util.List<java.lang.String> getKeys()
-
getPrivateKey
public abstract java.security.PrivateKey getPrivateKey(java.lang.String keyId) throws CryptoProviderException
- Throws:
CryptoProviderException
-
getPublicKey
public abstract java.security.PublicKey getPublicKey(java.lang.String alias) throws CryptoProviderException
- Throws:
CryptoProviderException
-
getKeyId
public java.lang.String getKeyId(JSONWebKeySet jsonWebKeySet, Algorithm algorithm, Use use) throws CryptoProviderException
- Throws:
CryptoProviderException
-
getJwksRequestParam
public io.jans.eleven.model.JwksRequestParam getJwksRequestParam(org.json.JSONObject jwkJsonObject)
-
generateJwks
public static org.json.JSONObject generateJwks(AbstractCryptoProvider cryptoProvider, AppConfiguration configuration)
-
getPublicKey
public java.security.PublicKey getPublicKey(java.lang.String alias, org.json.JSONObject jwks, Algorithm requestedAlgorithm) throws CryptoProviderException
- Throws:
CryptoProviderException
-
checkKeyExpiration
protected void checkKeyExpiration(java.lang.String alias, java.lang.Long expirationTime)
-
getKeyRegenerationIntervalInDays
public int getKeyRegenerationIntervalInDays()
-
setKeyRegenerationIntervalInDays
public void setKeyRegenerationIntervalInDays(int keyRegenerationIntervalInDays)
-
-