Difference between revisions of "Java PKCS11"

From Dogtag
Jump to: navigation, search
m (References)
m (Installation)
Line 4: Line 4:
  
 
== Installation ==
 
== Installation ==
 
See [https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html#ProviderInstalling Installing Providers].
 
  
 
=== Static Installation ===
 
=== Static Installation ===
Line 11: Line 9:
 
To install the provider statically, add the following property into $JAVA_HOME/lib/security/java.security:
 
To install the provider statically, add the following property into $JAVA_HOME/lib/security/java.security:
  
  security.provider.7=sun.security.pkcs11.SunPKCS11 /opt/bar/cfg/pkcs11.cfg
+
  security.provider.7=sun.security.pkcs11.SunPKCS11 /etc/pki/nssdb/pkcs11.cfg
  
 
=== Dynamic Installation ===
 
=== Dynamic Installation ===
Line 17: Line 15:
 
To install the provider dynamically, use the following code:
 
To install the provider dynamically, use the following code:
  
  String configName = "/opt/bar/cfg/pkcs11.cfg";
+
  String configName = "/etc/pki/nssdb";
 
  Provider p = new sun.security.pkcs11.SunPKCS11(configName);
 
  Provider p = new sun.security.pkcs11.SunPKCS11(configName);
 
  Security.addProvider(p);
 
  Security.addProvider(p);
 +
 +
== Configuration ==
 +
 +
name=NSS
 +
nssLibraryDirectory=/usr/lib64
 +
nssSecmodDirectory=/etc/pki/nssdb
 +
nssModule=keystore
  
 
= References =
 
= References =

Revision as of 12:09, 29 May 2018

Sun PKCS#11 Provider

Main class: sun.security.pkcs11.SunPKCS11

Installation

Static Installation

To install the provider statically, add the following property into $JAVA_HOME/lib/security/java.security:

security.provider.7=sun.security.pkcs11.SunPKCS11 /etc/pki/nssdb/pkcs11.cfg

Dynamic Installation

To install the provider dynamically, use the following code:

String configName = "/etc/pki/nssdb";
Provider p = new sun.security.pkcs11.SunPKCS11(configName);
Security.addProvider(p);

Configuration

name=NSS
nssLibraryDirectory=/usr/lib64
nssSecmodDirectory=/etc/pki/nssdb
nssModule=keystore

References