Example code:
Secmod secmod = Secmod.getInstance(); if (secmod.isInitialized() == false) { secmod.initialize("/home/myself/.mozilla"); } Provider p = secmod.getModule(ModuleType.KEYSTORE).getProvider(); KeyStore ks = KeyStore.getInstance("PKCS11", p); ks.load(null, password);
Modifier and Type | Class and Description |
---|---|
private static class | |
public static enum | |
public static class | Secmod.
A LoadStoreParameter for use with the NSS Softtoken or NSS TrustAnchor KeyStores. |
public static class | Secmod.
A representation of one PKCS#11 slot in a PKCS#11 module. |
public static enum | Secmod.
Constants describing the different types of NSS modules. |
pack-priv static class | |
public static enum | Secmod.
Constants representing NSS trust categories. |
Modifier and Type | Field and Description |
---|---|
private String | |
private static final boolean | |
private static final int | |
private static final Secmod | |
private List | |
private static final int | |
private static final String | |
private long | |
private String | |
private static final int | |
private static final String | |
private boolean | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
private static final String |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private void | |
pack-priv String | |
private static byte[] | |
public static Secmod | |
pack-priv String | |
public Secmod. | |
public synchronized List | |
private Secmod. | |
private static Map | |
public void | initialize(String
the directory containing the NSS configuration
files such as secmod.db configDir, String the directory containing the NSS libraries
(libnss3.so or nss3.dll) or null if the library is on
the system default shared library path nssLibDir)Initialize this Secmod. |
public void | |
public synchronized void | |
public synchronized boolean | |
private boolean | |
pack-priv boolean | |
private static native long | |
private static native Object | |
private static native boolean | |
private static native long | |
private static native boolean |
configDir | back to summary |
---|---|
private String configDir |
DEBUG | back to summary |
---|---|
private static final boolean DEBUG |
FIPS_SLOT_ID | back to summary |
---|---|
private static final int FIPS_SLOT_ID |
INSTANCE | back to summary |
---|---|
private static final Secmod INSTANCE |
modules | back to summary |
---|---|
private List<Secmod. |
NETSCAPE_SLOT_ID | back to summary |
---|---|
private static final int NETSCAPE_SLOT_ID |
NSS_LIB_NAME | back to summary |
---|---|
private static final String NSS_LIB_NAME |
nssHandle | back to summary |
---|---|
private long nssHandle |
nssLibDir | back to summary |
---|---|
private String nssLibDir |
PRIVATE_KEY_SLOT_ID | back to summary |
---|---|
private static final int PRIVATE_KEY_SLOT_ID |
SOFTTOKEN_LIB_NAME | back to summary |
---|---|
private static final String SOFTTOKEN_LIB_NAME |
supported | back to summary |
---|---|
private boolean supported |
TEMPLATE_CRYPTO | back to summary |
---|---|
pack-priv static final String TEMPLATE_CRYPTO |
TEMPLATE_EXTERNAL | back to summary |
---|---|
pack-priv static final String TEMPLATE_EXTERNAL |
TEMPLATE_FIPS | back to summary |
---|---|
pack-priv static final String TEMPLATE_FIPS |
TEMPLATE_KEYSTORE | back to summary |
---|---|
pack-priv static final String TEMPLATE_KEYSTORE |
TEMPLATE_TRUSTANCHOR | back to summary |
---|---|
pack-priv static final String TEMPLATE_TRUSTANCHOR |
TRUST_LIB_NAME | back to summary |
---|---|
private static final String TRUST_LIB_NAME |
Secmod | back to summary |
---|---|
private Secmod() |
fetchVersions | back to summary |
---|---|
private void fetchVersions() |
getConfigDir | back to summary |
---|---|
pack-priv String getConfigDir() |
getDigest | back to summary |
---|---|
private static byte[] getDigest(X509Certificate cert, String algorithm) |
getInstance | back to summary |
---|---|
public static Secmod getInstance() Return the singleton Secmod instance. |
getLibDir | back to summary |
---|---|
pack-priv String getLibDir() |
getModule | back to summary |
---|---|
public Secmod. Returns the first module of the specified type. If no such module exists, this method returns null.
|
getModules | back to summary |
---|---|
public synchronized List Return an immutable list of all available modules.
|
getModuleTrust | back to summary |
---|---|
private Secmod. |
getTrust | back to summary |
---|---|
private static Map |
initialize | back to summary |
---|---|
public void initialize(String configDir, String nssLibDir) throws IOException Initialize this Secmod.
|
initialize | back to summary |
---|---|
public void initialize(Secmod. |
initialize | back to summary |
---|---|
public synchronized void initialize(Secmod. |
isInitialized | back to summary |
---|---|
public synchronized boolean isInitialized() throws IOException Test whether this Secmod has been initialized. Returns true if NSS has been initialized using either the initialize() method or by directly calling the native NSS APIs. The latter may be the case if the current process contains components that use NSS directly.
|
isLoaded | back to summary |
---|---|
private boolean isLoaded() |
isTrusted | back to summary |
---|---|
pack-priv boolean isTrusted(X509Certificate cert, Secmod. |
nssGetLibraryHandle | back to summary |
---|---|
private static native long nssGetLibraryHandle(String libraryName) |
nssGetModuleList | back to summary |
---|---|
private static native Object nssGetModuleList(long handle, String libDir) |
nssInitialize | back to summary |
---|---|
private static native boolean nssInitialize(String functionName, long handle, String configDir, boolean nssOptimizeSpace) |
nssLoadLibrary | back to summary |
---|---|
private static native long nssLoadLibrary(String name) throws IOException |
nssVersionCheck | back to summary |
---|---|
private static native boolean nssVersionCheck(long handle, String minVersion) |
Modifier and Type | Field and Description |
---|---|
pack-priv final byte[] |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
public int |
b | back to summary |
---|---|
pack-priv final byte[] b |
Bytes | back to summary |
---|---|
pack-priv Bytes(byte[] b) |
equals | back to summary |
---|---|
public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
|
Modifier and Type | Field and Description |
---|---|
pack-priv final String | |
public static final Secmod. | |
public static final Secmod. | |
public static final Secmod. |
Modifier and Type | Method and Description |
---|---|
public static Secmod. | |
public static Secmod. |
functionName | back to summary |
---|---|
pack-priv final String functionName |
NO_DB | back to summary |
---|---|
public static final Secmod. |
READ_ONLY | back to summary |
---|---|
public static final Secmod. |
READ_WRITE | back to summary |
---|---|
public static final Secmod. |
DbMode | back to summary |
---|---|
private DbMode(String functionName) |
valueOf | back to summary |
---|---|
public static Secmod. |
values | back to summary |
---|---|
public static Secmod. |
It allows the set of trusted certificates that are returned by the KeyStore to be specified.
Modifier and Type | Field and Description |
---|---|
pack-priv final KeyStore. | |
pack-priv final Secmod. |
Access | Constructor and Description |
---|---|
public | |
public |
Modifier and Type | Method and Description |
---|---|
public KeyStore. | getProtectionParameter()
Implements java. Gets the parameter used to protect keystore data. |
public Secmod. |
protection | back to summary |
---|---|
pack-priv final KeyStore. |
trustType | back to summary |
---|---|
pack-priv final Secmod. |
KeyStoreLoadParameter | back to summary |
---|---|
public KeyStoreLoadParameter(Secmod. |
KeyStoreLoadParameter | back to summary |
---|---|
public KeyStoreLoadParameter(Secmod. |
getProtectionParameter | back to summary |
---|---|
public KeyStore. Implements java. Doc from java. Gets the parameter used to protect keystore data.
|
getTrustType | back to summary |
---|---|
public Secmod. |
Modifier and Type | Field and Description |
---|---|
pack-priv final String | |
private String | |
pack-priv final String | |
private SunPKCS11 | |
pack-priv final int | |
private Map | |
pack-priv final Secmod. |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public synchronized String | |
public String | |
public synchronized Provider | |
pack-priv Secmod. | |
public Secmod. | |
pack-priv synchronized boolean | |
private void | |
private SunPKCS11 | |
public synchronized void | |
pack-priv void | |
pack-priv synchronized void | |
public String |
commonName | back to summary |
---|---|
pack-priv final String commonName |
config | back to summary |
---|---|
private String config |
libraryName | back to summary |
---|---|
pack-priv final String libraryName |
provider | back to summary |
---|---|
private SunPKCS11 provider |
slot | back to summary |
---|---|
pack-priv final int slot |
trust | back to summary |
---|---|
private Map<Secmod. |
type | back to summary |
---|---|
pack-priv final Secmod. |
Module | back to summary |
---|---|
pack-priv Module(String libraryDir, String libraryName, String commonName, int slotIndex, int slotId) |
getConfiguration | back to summary |
---|---|
public synchronized String getConfiguration()
Deprecated
Get the configuration for this module. This is a string in the SunPKCS11 configuration format. It can be customized with additional options and then made current using the setConfiguration() method.
|
getLibraryName | back to summary |
---|---|
public String getLibraryName() Return the pathname of the native library that implements this module. For example, /usr/lib/libpkcs11.so. |
getProvider | back to summary |
---|---|
public synchronized Provider getProvider()
Deprecated
Returns the provider instance that is associated with this module. The first call to this method creates the provider instance.
|
getTrust | back to summary |
---|---|
pack-priv Secmod. |
getType | back to summary |
---|---|
public Secmod. Returns the type of this module. |
hasInitializedProvider | back to summary |
---|---|
pack-priv synchronized boolean hasInitializedProvider() |
initConfiguration | back to summary |
---|---|
private void initConfiguration() |
newProvider | back to summary |
---|---|
private SunPKCS11 newProvider() |
setConfiguration | back to summary |
---|---|
public synchronized void setConfiguration(String config)
Deprecated
Set the configuration for this module.
|
setProvider | back to summary |
---|---|
pack-priv void setProvider(SunPKCS11 p) |
setTrust | back to summary |
---|---|
pack-priv synchronized void setTrust(Token token, X509Certificate cert) |
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
|
Modifier and Type | Field and Description |
---|---|
public static final Secmod. | CRYPTO
The NSS Softtoken crypto module. |
public static final Secmod. | EXTERNAL
An external module. |
public static final Secmod. | FIPS
The NSS Softtoken module in FIPS mode. |
public static final Secmod. | KEYSTORE
The NSS Softtoken KeyStore module. |
public static final Secmod. | TRUSTANCHOR
The NSS builtin trust anchor module. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static Secmod. | |
public static Secmod. |
CRYPTO | back to summary |
---|---|
public static final Secmod. The NSS Softtoken crypto module. This is the first slot of the softtoken object. This module provides implementations for cryptographic algorithms but no KeyStore. |
EXTERNAL | back to summary |
---|---|
public static final Secmod. An external module. |
FIPS | back to summary |
---|---|
public static final Secmod. The NSS Softtoken module in FIPS mode. Note that in FIPS mode the softtoken presents only one slot, not separate CRYPTO and KEYSTORE slots as in non-FIPS mode. |
KEYSTORE | back to summary |
---|---|
public static final Secmod. The NSS Softtoken KeyStore module. This is the second slot of the softtoken object. This module provides implementations for cryptographic algorithms (after login) and the KeyStore. |
TRUSTANCHOR | back to summary |
---|---|
public static final Secmod. The NSS builtin trust anchor module. This is the NSSCKBI object. It provides no crypto functions. |
ModuleType | back to summary |
---|---|
private ModuleType() |
valueOf | back to summary |
---|---|
public static Secmod. |
values | back to summary |
---|---|
public static Secmod. |
Modifier and Type | Field and Description |
---|---|
pack-priv final long | |
pack-priv final long | |
pack-priv final long | |
pack-priv final long | |
pack-priv final long | |
pack-priv final byte[] |
Access | Constructor and Description |
---|---|
pack-priv | |
pack-priv |
Modifier and Type | Method and Description |
---|---|
pack-priv Secmod. | |
pack-priv boolean | |
private boolean |
clientAuth | back to summary |
---|---|
pack-priv final long clientAuth |
codeSigning | back to summary |
---|---|
pack-priv final long codeSigning |
emailProtection | back to summary |
---|---|
pack-priv final long emailProtection |
handle | back to summary |
---|---|
pack-priv final long handle |
serverAuth | back to summary |
---|---|
pack-priv final long serverAuth |
shaHash | back to summary |
---|---|
pack-priv final byte[] shaHash |
TrustAttributes | back to summary |
---|---|
pack-priv TrustAttributes(Token token, X509Certificate cert, Secmod. |
TrustAttributes | back to summary |
---|---|
pack-priv TrustAttributes(Token token, Session session, long handle) throws PKCS11Exception |
getHash | back to summary |
---|---|
pack-priv Secmod. |
isTrusted | back to summary |
---|---|
pack-priv boolean isTrusted(Secmod. |
isTrusted | back to summary |
---|---|
private boolean isTrusted(long l) |
Modifier and Type | Field and Description |
---|---|
public static final Secmod. | ALL
Trusted for all purposes |
public static final Secmod. | CLIENT_AUTH
Trusted for SSL client authentication |
public static final Secmod. | CODE_SIGNING
Trusted for code signing |
public static final Secmod. | EMAIL_PROTECTION
Trusted for email protection |
public static final Secmod. | SERVER_AUTH
Trusted for SSL server authentication |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static Secmod. | |
public static Secmod. |
ALL | back to summary |
---|---|
public static final Secmod. Trusted for all purposes |
CLIENT_AUTH | back to summary |
---|---|
public static final Secmod. Trusted for SSL client authentication |
CODE_SIGNING | back to summary |
---|---|
public static final Secmod. Trusted for code signing |
EMAIL_PROTECTION | back to summary |
---|---|
public static final Secmod. Trusted for email protection |
SERVER_AUTH | back to summary |
---|---|
public static final Secmod. Trusted for SSL server authentication |
TrustType | back to summary |
---|---|
private TrustType() |
valueOf | back to summary |
---|---|
public static Secmod. |
values | back to summary |
---|---|
public static Secmod. |