Top Description Inners Fields Constructors Methods
org.bouncycastle.jce.provider

public final Class BouncyCastleProvider

extends Provider
implements ConfigurableProvider
Class Inheritance
All Implemented Interfaces
org.bouncycastle.jcajce.provider.config.ConfigurableProvider
Imports
java.io.IOException, java.security.AccessController, .PrivateKey, .PrivilegedAction, .Provider, .PublicKey, java.util.HashMap, .Iterator, .Map, java.util.concurrent.ConcurrentHashMap, java.util.logging.Level, .Logger, org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.bc.BCObjectIdentifiers, org.bouncycastle.asn1.isara.IsaraObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, .PrivateKeyInfo, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo, org.bouncycastle.crypto.CryptoServiceConstraintsException, .CryptoServiceProperties, .CryptoServicePurpose, .CryptoServicesRegistrar, org.bouncycastle.jcajce.provider.config.ConfigurableProvider, .ProviderConfiguration, org.bouncycastle.jcajce.provider.symmetric.util.ClassUtil, org.bouncycastle.jcajce.provider.util.AlgorithmProvider, .AsymmetricKeyInfoConverter, org.bouncycastle.pqc.asn1.PQCObjectIdentifiers, org.bouncycastle.pqc.jcajce.provider.bike.BIKEKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.cmce.CMCEKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.dilithium.DilithiumKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.falcon.FalconKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.hqc.HQCKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.kyber.KyberKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.lms.LMSKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.newhope.NHKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.ntru.NTRUKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.picnic.PicnicKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.sphincs.Sphincs256KeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.sphincsplus.SPHINCSPlusKeyFactorySpi, org.bouncycastle.pqc.jcajce.provider.xmss.XMSSKeyFactorySpi, .XMSSMTKeyFactorySpi, org.bouncycastle.util.Strings

To add the provider at runtime use:
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;

Security.addProvider(new BouncyCastleProvider());
The provider can also be configured as part of your environment via static registration by adding an entry to the java.security properties file (found in $JAVA_HOME/jre/lib/security/java.security, where $JAVA_HOME is the location of your JDK/JRE distribution). You'll find detailed instructions in the file but basically it comes down to adding a line:

   security.provider.<n>=org.bouncycastle.jce.provider.BouncyCastleProvider

Where <n> is the preference you want the provider at (1 being the most preferred).

Note

JCE algorithm names should be upper-case only so the case insensitive test for getInstance works.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final String[]
private static final String[]
private static final String
public static final ProviderConfiguration
private static final String
private static final String[]
private static String
private static final Map<K, V>
private static final String
private static final String[]
private static final Logger
public static final String
private static final Class<T>
private static final String
private static final String[]
private Map<String, Provider.Service>
private static final CryptoServiceProperties[]
private static final String[]
private static final String[]
private static final String

Constructor Summary

AccessConstructor and Description
public
BouncyCastleProvider()

Construct a new provider.

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
public void
public void
private static AsymmetricKeyInfoConverter
public AsymmetricKeyInfoConverter
public static PrivateKey
getPrivateKey(PrivateKeyInfo privateKeyInfo)

public static PublicKey
public final Provider.Service
getService(final String
the type of service requested (for example, MessageDigest)
type
,
final String
the case-insensitive algorithm name (or alternate alias) of the service requested (for example, SHA-1)
algorithm
)

Overrides java.security.Provider.getService.

Get the service describing this Provider's implementation of the specified type of this algorithm or alias.
public boolean
private void
loadAlgorithms(String packageName, String[] names)

private void
private void
private void
loadServiceClass(String packageName, String serviceName)

private static CryptoServiceProperties
service(String name, int bitsOfSecurity)

public void
private void
Inherited from java.security.Provider:
clearcomputecomputeIfAbsentcomputeIfPresentconfigureelementsentrySetforEachgetgetInfogetNamegetOrDefaultgetPropertygetServicesgetVersiongetVersionStrisConfiguredkeyskeySetloadmergeputputAllputIfAbsentputServiceremoveremoveremoveServicereplacereplacereplaceAlltoStringvalues

Field Detail

ASYMMETRIC_CIPHERSback to summary
private static final String[] ASYMMETRIC_CIPHERS
ASYMMETRIC_GENERICback to summary
private static final String[] ASYMMETRIC_GENERIC
ASYMMETRIC_PACKAGEback to summary
private static final String ASYMMETRIC_PACKAGE
CONFIGURATIONback to summary
public static final ProviderConfiguration CONFIGURATION
DIGEST_PACKAGEback to summary
private static final String DIGEST_PACKAGE
DIGESTSback to summary
private static final String[] DIGESTS
infoback to summary
private static String info

Hides java.security.Provider.info.

keyInfoConvertersback to summary
private static final Map<K, V> keyInfoConverters
KEYSTORE_PACKAGEback to summary
private static final String KEYSTORE_PACKAGE
KEYSTORESback to summary
private static final String[] KEYSTORES
LOGback to summary
private static final Logger LOG
PROVIDER_NAMEback to summary
public static final String PROVIDER_NAME
revChkClassback to summary
private static final Class<T> revChkClass
SECURE_RANDOM_PACKAGEback to summary
private static final String SECURE_RANDOM_PACKAGE
SECURE_RANDOMSback to summary
private static final String[] SECURE_RANDOMS
serviceMapback to summary
private Map<String, Provider.Service> serviceMap

Hides java.security.Provider.serviceMap.

SYMMETRIC_CIPHERSback to summary
private static final CryptoServiceProperties[] SYMMETRIC_CIPHERS
SYMMETRIC_GENERICback to summary
private static final String[] SYMMETRIC_GENERIC
SYMMETRIC_MACSback to summary
private static final String[] SYMMETRIC_MACS
SYMMETRIC_PACKAGEback to summary
private static final String SYMMETRIC_PACKAGE

Constructor Detail

BouncyCastleProviderback to summary
public BouncyCastleProvider()

Construct a new provider. This should only be required when using runtime registration of the provider using the Security.addProvider() mechanism.

Method Detail

addAlgorithmback to summary
public void addAlgorithm(String key, String value)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.addAlgorithm.

addAlgorithmback to summary
public void addAlgorithm(String key, String value, Map<String, String> attributes)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.addAlgorithm.

addAlgorithmback to summary
public void addAlgorithm(String type, ASN1ObjectIdentifier oid, String className)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.addAlgorithm.

addAlgorithmback to summary
public void addAlgorithm(String type, ASN1ObjectIdentifier oid, String className, Map<String, String> attributes)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.addAlgorithm.

addAttributesback to summary
public void addAttributes(String key, Map<String, String> attributeMap)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.addAttributes.

addKeyInfoConverterback to summary
public void addKeyInfoConverter(ASN1ObjectIdentifier oid, AsymmetricKeyInfoConverter keyInfoConverter)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.addKeyInfoConverter.

getAsymmetricKeyInfoConverterback to summary
private static AsymmetricKeyInfoConverter getAsymmetricKeyInfoConverter(ASN1ObjectIdentifier algorithm)
getKeyInfoConverterback to summary
public AsymmetricKeyInfoConverter getKeyInfoConverter(ASN1ObjectIdentifier oid)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.getKeyInfoConverter.

getPrivateKeyback to summary
public static PrivateKey getPrivateKey(PrivateKeyInfo privateKeyInfo) throws IOException
getPublicKeyback to summary
public static PublicKey getPublicKey(SubjectPublicKeyInfo publicKeyInfo) throws IOException
getServiceback to summary
public final Provider.Service getService(final String type, final String algorithm)

Overrides java.security.Provider.getService.

Doc from java.security.Provider.getService.

Get the service describing this Provider's implementation of the specified type of this algorithm or alias. If no such implementation exists, this method returns null. If there are two matching services, one added to this provider using putService() and one added via put(), the service added via putService() is returned.

Parameters
type:String

the type of service requested (for example, MessageDigest)

algorithm:String

the case-insensitive algorithm name (or alternate alias) of the service requested (for example, SHA-1)

Returns:Provider.Service

the service describing this Provider's matching service or null if no such service exists

hasAlgorithmback to summary
public boolean hasAlgorithm(String type, String name)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.hasAlgorithm.

loadAlgorithmsback to summary
private void loadAlgorithms(String packageName, String[] names)
loadAlgorithmsback to summary
private void loadAlgorithms(String packageName, CryptoServiceProperties[] services)
loadPQCKeysback to summary
private void loadPQCKeys()
loadServiceClassback to summary
private void loadServiceClass(String packageName, String serviceName)
serviceback to summary
private static CryptoServiceProperties service(String name, int bitsOfSecurity)
setParameterback to summary
public void setParameter(String parameterName, Object parameter)

Implements org.bouncycastle.jcajce.provider.config.ConfigurableProvider.setParameter.

setupback to summary
private void setup()
org.bouncycastle.jce.provider back to summary

private Class BouncyCastleProvider.JcaCryptoService

extends Object
implements CryptoServiceProperties
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.jce.provider.BouncyCastleProvider.JcaCryptoService
All Implemented Interfaces
org.bouncycastle.crypto.CryptoServiceProperties

Field Summary

Modifier and TypeField and Description
private final int
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
JcaCryptoService(String name, int bitsOfSecurity)

Method Summary

Modifier and TypeMethod and Description
public int
public Object
public CryptoServicePurpose
public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bitsOfSecurityback to summary
private final int bitsOfSecurity
nameback to summary
private final String name

Constructor Detail

JcaCryptoServiceback to summary
pack-priv JcaCryptoService(String name, int bitsOfSecurity)

Method Detail

bitsOfSecurityback to summary
public int bitsOfSecurity()

Implements org.bouncycastle.crypto.CryptoServiceProperties.bitsOfSecurity.

getParamsback to summary
public Object getParams()

Implements org.bouncycastle.crypto.CryptoServiceProperties.getParams.

getPurposeback to summary
public CryptoServicePurpose getPurpose()

Implements org.bouncycastle.crypto.CryptoServiceProperties.getPurpose.

getServiceNameback to summary
public String getServiceName()

Implements org.bouncycastle.crypto.CryptoServiceProperties.getServiceName.