Package org.jose4j.jca
Class ProviderContext.Context
java.lang.Object
org.jose4j.jca.ProviderContext.Context
- Enclosing class:
- ProviderContext
Allows for a provider to be named for various operations.
Not all operations are relevant in any particular JOSE context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the JCA provider to be used for relevantCipheroperations.Gets the general JCA provider to be used for all relevant operations when a more specific one isn't set.Gets the JCA provider to be used for relevantKeyAgreementoperations.Gets the cipher mode to use when deciphering/decrypting/unwrapping an encrypted content encryption key.Gets the JCA provider to be used for relevantKeyFactoryoperations.Gets the JCA provider to be used for relevantKeyPairGeneratoroperations.Gets the JCA provider to be used for relevantMacoperations.Gets the JCA provider to be used for relevantMessageDigestoperations.Gets the algorithm info (name and parameter spec) to be used as overrides for relevantSignatureoperations.Gets the JCA provider to be used for relevantSignatureoperations.voidsetCipherProvider(String cipherProvider) Sets the JCA provider to be used for relevantCipheroperations.voidsetGeneralProvider(String generalProvider) Sets the general JCA provider to be used for all relevant operations when a more specific one isn't set.voidsetKeyAgreementProvider(String keyAgreementProvider) Sets the JCA provider to be used for relevantKeyAgreementoperations.voidsetKeyDecipherModeOverride(ProviderContext.KeyDecipherMode keyDecipherModeOverride) Sets the cipher mode to use when deciphering/decrypting/unwrapping an encrypted content encryption key.voidsetKeyFactoryProvider(String keyFactoryProvider) Sets the JCA provider to be used for relevantKeyFactoryoperations.voidsetKeyPairGeneratorProvider(String keyPairGeneratorProvider) Sets the JCA provider to be used for relevantKeyPairGeneratoroperations.voidsetMacProvider(String macProvider) Sets the JCA provider to be used for relevantMacoperations.voidsetMessageDigestProvider(String messageDigestProvider) Sets the JCA provider to be used for relevantMessageDigestoperations.voidsetSignatureAlgorithmOverride(ProviderContext.SignatureAlgorithmOverride signatureAlgorithmOverride) Sets the algorithm info (name and parameter spec) to be used as overrides for relevantSignatureoperations.voidsetSignatureProvider(String signatureProvider) Sets the JCA provider to be used for relevantSignatureoperations.
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
getGeneralProvider
Gets the general JCA provider to be used for all relevant operations when a more specific one isn't set.- Returns:
- the general JCA provider name
-
setGeneralProvider
Sets the general JCA provider to be used for all relevant operations when a more specific one isn't set.nullto use the system configured providers.- Parameters:
generalProvider- the provider name
-
getKeyPairGeneratorProvider
Gets the JCA provider to be used for relevantKeyPairGeneratoroperations.- Returns:
- the name of the provider or
nullfor the system configured providers.
-
setKeyPairGeneratorProvider
Sets the JCA provider to be used for relevantKeyPairGeneratoroperations.nullto use the system configured providers.- Parameters:
keyPairGeneratorProvider- the provider name
-
getKeyAgreementProvider
Gets the JCA provider to be used for relevantKeyAgreementoperations.- Returns:
- the name of the provider or
nullfor the system configured providers.
-
setKeyAgreementProvider
Sets the JCA provider to be used for relevantKeyAgreementoperations.nullto use the system configured providers.- Parameters:
keyAgreementProvider- the provider name
-
getCipherProvider
Gets the JCA provider to be used for relevantCipheroperations.- Returns:
- the name of the provider or
nullfor the system configured providers.
-
setCipherProvider
Sets the JCA provider to be used for relevantCipheroperations.nullto use the system configured providers.- Parameters:
cipherProvider- the provider name
-
getKeyDecipherModeOverride
Gets the cipher mode to use when deciphering/decrypting/unwrapping an encrypted content encryption key.- Returns:
- the mode
- Since:
- 0.9.1
-
setKeyDecipherModeOverride
Sets the cipher mode to use when deciphering/decrypting/unwrapping an encrypted content encryption key. Using decrypt mode with certain JCA providers might be necessary for access to the raw bytes of the decrypted key, which are needed when decrypting the JWE Ciphertext.- Parameters:
keyDecipherModeOverride- the mode- Since:
- 0.9.1
-
getSignatureProvider
Gets the JCA provider to be used for relevantSignatureoperations.- Returns:
- the name of the provider or
nullfor the system configured providers.
-
setSignatureProvider
Sets the JCA provider to be used for relevantSignatureoperations.nullto use the system configured providers.- Parameters:
signatureProvider- the provider name
-
getSignatureAlgorithmOverride
Gets the algorithm info (name and parameter spec) to be used as overrides for relevantSignatureoperations. Null means no override is done and the normal algorithm details are used.- Returns:
- the SignatureAlgorithmOverride object or null
-
setSignatureAlgorithmOverride
public void setSignatureAlgorithmOverride(ProviderContext.SignatureAlgorithmOverride signatureAlgorithmOverride) Sets the algorithm info (name and parameter spec) to be used as overrides for relevantSignatureoperations. The need for this should be quite rare but it could be useful in cases where different providers are using different names for the same algorithm - and there have been some naming inconsistencies with RSAPSS where RSASSA-PSS + AlgorithmParameterSpec was used when PSS support was added to the default JRE but providers that supported PSS earlier used something like SHA256withRSAandMGF1).- Parameters:
signatureAlgorithmOverride- with the algorithm info. Null indicates to use the defaults (and is the default in and of itself).
-
getMacProvider
Gets the JCA provider to be used for relevantMacoperations.- Returns:
- of the Mac provider or
nullfor the system configured providers.
-
setMacProvider
Sets the JCA provider to be used for relevantMacoperations.nullto use the system configured providers.- Parameters:
macProvider- the provider name
-
getMessageDigestProvider
Gets the JCA provider to be used for relevantMessageDigestoperations.- Returns:
- the name of the provider or
nullfor the system configured providers.
-
setMessageDigestProvider
Sets the JCA provider to be used for relevantMessageDigestoperations.nullto use the system configured providers.- Parameters:
messageDigestProvider- the provider name
-
getKeyFactoryProvider
Gets the JCA provider to be used for relevantKeyFactoryoperations.- Returns:
- the name of the provider or
nullfor the system configured providers.
-
setKeyFactoryProvider
Sets the JCA provider to be used for relevantKeyFactoryoperations.nullto use the system configured providers.- Parameters:
keyFactoryProvider- the provider name
-