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
-
Method Summary
Modifier and TypeMethodDescriptionGets the JCA provider to be used for relevantCipher
operations.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 relevantKeyAgreement
operations.Gets the cipher mode to use when deciphering/decrypting/unwrapping an encrypted content encryption key.Gets the JCA provider to be used for relevantKeyFactory
operations.Gets the JCA provider to be used for relevantKeyPairGenerator
operations.Gets the JCA provider to be used for relevantMac
operations.Gets the JCA provider to be used for relevantMessageDigest
operations.Gets the algorithm info (name and parameter spec) to be used as overrides for relevantSignature
operations.Gets the JCA provider to be used for relevantSignature
operations.void
setCipherProvider
(String cipherProvider) Sets the JCA provider to be used for relevantCipher
operations.void
setGeneralProvider
(String generalProvider) Sets the general JCA provider to be used for all relevant operations when a more specific one isn't set.void
setKeyAgreementProvider
(String keyAgreementProvider) Sets the JCA provider to be used for relevantKeyAgreement
operations.void
setKeyDecipherModeOverride
(ProviderContext.KeyDecipherMode keyDecipherModeOverride) Sets the cipher mode to use when deciphering/decrypting/unwrapping an encrypted content encryption key.void
setKeyFactoryProvider
(String keyFactoryProvider) Sets the JCA provider to be used for relevantKeyFactory
operations.void
setKeyPairGeneratorProvider
(String keyPairGeneratorProvider) Sets the JCA provider to be used for relevantKeyPairGenerator
operations.void
setMacProvider
(String macProvider) Sets the JCA provider to be used for relevantMac
operations.void
setMessageDigestProvider
(String messageDigestProvider) Sets the JCA provider to be used for relevantMessageDigest
operations.void
setSignatureAlgorithmOverride
(ProviderContext.SignatureAlgorithmOverride signatureAlgorithmOverride) Sets the algorithm info (name and parameter spec) to be used as overrides for relevantSignature
operations.void
setSignatureProvider
(String signatureProvider) Sets the JCA provider to be used for relevantSignature
operations.
-
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.null
to use the system configured providers.- Parameters:
generalProvider
- the provider name
-
getKeyPairGeneratorProvider
Gets the JCA provider to be used for relevantKeyPairGenerator
operations.- Returns:
- the name of the provider or
null
for the system configured providers.
-
setKeyPairGeneratorProvider
Sets the JCA provider to be used for relevantKeyPairGenerator
operations.null
to use the system configured providers.- Parameters:
keyPairGeneratorProvider
- the provider name
-
getKeyAgreementProvider
Gets the JCA provider to be used for relevantKeyAgreement
operations.- Returns:
- the name of the provider or
null
for the system configured providers.
-
setKeyAgreementProvider
Sets the JCA provider to be used for relevantKeyAgreement
operations.null
to use the system configured providers.- Parameters:
keyAgreementProvider
- the provider name
-
getCipherProvider
Gets the JCA provider to be used for relevantCipher
operations.- Returns:
- the name of the provider or
null
for the system configured providers.
-
setCipherProvider
Sets the JCA provider to be used for relevantCipher
operations.null
to 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 relevantSignature
operations.- Returns:
- the name of the provider or
null
for the system configured providers.
-
setSignatureProvider
Sets the JCA provider to be used for relevantSignature
operations.null
to 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 relevantSignature
operations. 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 relevantSignature
operations. 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 relevantMac
operations.- Returns:
- of the Mac provider or
null
for the system configured providers.
-
setMacProvider
Sets the JCA provider to be used for relevantMac
operations.null
to use the system configured providers.- Parameters:
macProvider
- the provider name
-
getMessageDigestProvider
Gets the JCA provider to be used for relevantMessageDigest
operations.- Returns:
- the name of the provider or
null
for the system configured providers.
-
setMessageDigestProvider
Sets the JCA provider to be used for relevantMessageDigest
operations.null
to use the system configured providers.- Parameters:
messageDigestProvider
- the provider name
-
getKeyFactoryProvider
Gets the JCA provider to be used for relevantKeyFactory
operations.- Returns:
- the name of the provider or
null
for the system configured providers.
-
setKeyFactoryProvider
Sets the JCA provider to be used for relevantKeyFactory
operations.null
to use the system configured providers.- Parameters:
keyFactoryProvider
- the provider name
-