public final class BouncyCastleProvider extends java.security.Provider implements ConfigurableProvider
import java.security.Security; import org.spongycastle.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.spongycastle.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.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ASYMMETRIC_CIPHER_PACKAGE |
private static java.lang.String[] |
ASYMMETRIC_CIPHERS |
private static java.lang.String[] |
ASYMMETRIC_GENERIC |
static ProviderConfiguration |
CONFIGURATION |
private static java.lang.String |
DIGEST_PACKAGE |
private static java.lang.String[] |
DIGESTS |
private static java.lang.String |
info |
private static java.util.Map |
keyInfoConverters |
static java.lang.String |
PROVIDER_NAME |
private static java.lang.String |
SYMMETRIC_CIPHER_PACKAGE |
private static java.lang.String[] |
SYMMETRIC_CIPHERS |
DH_DEFAULT_PARAMS, EC_IMPLICITLY_CA, THREAD_LOCAL_DH_DEFAULT_PARAMS, THREAD_LOCAL_EC_IMPLICITLY_CA
Constructor and Description |
---|
BouncyCastleProvider()
Construct a new provider.
|
Modifier and Type | Method and Description |
---|---|
void |
addAlgorithm(java.lang.String key,
java.lang.String value) |
void |
addKeyInfoConverter(ASN1ObjectIdentifier oid,
AsymmetricKeyInfoConverter keyInfoConverter) |
private void |
addMacAlgorithms() |
AsymmetricKeyInfoConverter |
getConverter(ASN1ObjectIdentifier oid) |
static java.security.PrivateKey |
getPrivateKey(PrivateKeyInfo privateKeyInfo) |
static java.security.PublicKey |
getPublicKey(SubjectPublicKeyInfo publicKeyInfo) |
boolean |
hasAlgorithm(java.lang.String type,
java.lang.String name) |
private void |
loadAlgorithms(java.lang.String packageName,
java.lang.String[] names) |
void |
setParameter(java.lang.String parameterName,
java.lang.Object parameter) |
private void |
setup() |
clear, elements, entrySet, get, getInfo, getName, getProperty, getService, getServices, getVersion, keys, keySet, load, put, putAll, putService, remove, removeService, toString, values
getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
private static java.lang.String info
public static java.lang.String PROVIDER_NAME
public static final ProviderConfiguration CONFIGURATION
private static final java.util.Map keyInfoConverters
private static final java.lang.String SYMMETRIC_CIPHER_PACKAGE
private static final java.lang.String[] SYMMETRIC_CIPHERS
private static final java.lang.String ASYMMETRIC_CIPHER_PACKAGE
private static final java.lang.String[] ASYMMETRIC_GENERIC
private static final java.lang.String[] ASYMMETRIC_CIPHERS
private static final java.lang.String DIGEST_PACKAGE
private static final java.lang.String[] DIGESTS
public BouncyCastleProvider()
Security.addProvider()
mechanism.private void setup()
private void loadAlgorithms(java.lang.String packageName, java.lang.String[] names)
private void addMacAlgorithms()
public void setParameter(java.lang.String parameterName, java.lang.Object parameter)
setParameter
in interface ConfigurableProvider
public boolean hasAlgorithm(java.lang.String type, java.lang.String name)
hasAlgorithm
in interface ConfigurableProvider
public void addAlgorithm(java.lang.String key, java.lang.String value)
addAlgorithm
in interface ConfigurableProvider
public void addKeyInfoConverter(ASN1ObjectIdentifier oid, AsymmetricKeyInfoConverter keyInfoConverter)
addKeyInfoConverter
in interface ConfigurableProvider
public AsymmetricKeyInfoConverter getConverter(ASN1ObjectIdentifier oid)
getConverter
in interface ConfigurableProvider
public static java.security.PublicKey getPublicKey(SubjectPublicKeyInfo publicKeyInfo) throws java.io.IOException
java.io.IOException
public static java.security.PrivateKey getPrivateKey(PrivateKeyInfo privateKeyInfo) throws java.io.IOException
java.io.IOException