xades4j.providers.impl
Class PKCS11KeyStoreKeyingDataProvider

java.lang.Object
  extended by xades4j.providers.impl.KeyStoreKeyingDataProvider
      extended by xades4j.providers.impl.PKCS11KeyStoreKeyingDataProvider
All Implemented Interfaces:
KeyingDataProvider

public class PKCS11KeyStoreKeyingDataProvider
extends KeyStoreKeyingDataProvider

A specification of KeyStoreKeyingDataProvider for PKCS#11 keystores. This class uses the SUN's PKCS#11 provider, which brigdes with the native PKCS#11 library.

The KeyStorePasswordProvider and KeyEntryPasswordProvider may be null. In that case the keystore protection has to be handled by the native library. If the KeyEntryPasswordProvider is supplied, the protection used to access an entry is a CallbackHandlerProtection that invokes the KeyEntryPasswordProvider exactly when when the password is requested.

Author:
Luís
See Also:
KeyStoreKeyingDataProvider

Nested Class Summary
 
Nested classes/interfaces inherited from class xades4j.providers.impl.KeyStoreKeyingDataProvider
KeyStoreKeyingDataProvider.KeyEntryPasswordProvider, KeyStoreKeyingDataProvider.KeyStoreBuilderCreator, KeyStoreKeyingDataProvider.KeyStorePasswordProvider, KeyStoreKeyingDataProvider.SigningCertSelector
 
Constructor Summary
PKCS11KeyStoreKeyingDataProvider(String nativeLibraryPath, String providerName, KeyStoreKeyingDataProvider.SigningCertSelector certificateSelector)
          Shortcut for the other constructor using null for the password providers and false for the returnFullChain parameter.
PKCS11KeyStoreKeyingDataProvider(String nativeLibraryPath, String providerName, KeyStoreKeyingDataProvider.SigningCertSelector certificateSelector, KeyStoreKeyingDataProvider.KeyStorePasswordProvider keyStorePasswordProvider, KeyStoreKeyingDataProvider.KeyEntryPasswordProvider entryPasswordProvider, boolean returnFullChain)
           
 
Method Summary
protected  KeyStore.ProtectionParameter getKeyProtection(String entryAlias, X509Certificate entryCert, KeyStoreKeyingDataProvider.KeyEntryPasswordProvider entryPasswordProvider)
          Gets a protection parameter to access the specified entry.
 
Methods inherited from class xades4j.providers.impl.KeyStoreKeyingDataProvider
getSigningCertificateChain, getSigningKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS11KeyStoreKeyingDataProvider

public PKCS11KeyStoreKeyingDataProvider(String nativeLibraryPath,
                                        String providerName,
                                        KeyStoreKeyingDataProvider.SigningCertSelector certificateSelector,
                                        KeyStoreKeyingDataProvider.KeyStorePasswordProvider keyStorePasswordProvider,
                                        KeyStoreKeyingDataProvider.KeyEntryPasswordProvider entryPasswordProvider,
                                        boolean returnFullChain)
                                 throws KeyStoreException
Parameters:
nativeLibraryPath - the path for the native library of the specific PKCS#11 provider
providerName - this string is concatenated with the prefix SunPKCS11- to produce this provider instance's name
certificateSelector - the selector of signing certificate
keyStorePasswordProvider - the provider of the keystore loading password (may be null)
entryPasswordProvider - the provider of entry passwords (may be null)
returnFullChain - indicates of the full certificate chain should be returned, if available
Throws:
KeyStoreException

PKCS11KeyStoreKeyingDataProvider

public PKCS11KeyStoreKeyingDataProvider(String nativeLibraryPath,
                                        String providerName,
                                        KeyStoreKeyingDataProvider.SigningCertSelector certificateSelector)
                                 throws KeyStoreException
Shortcut for the other constructor using null for the password providers and false for the returnFullChain parameter.

Parameters:
nativeLibraryPath -
providerName -
certificateSelector -
Throws:
KeyStoreException
Method Detail

getKeyProtection

protected final KeyStore.ProtectionParameter getKeyProtection(String entryAlias,
                                                              X509Certificate entryCert,
                                                              KeyStoreKeyingDataProvider.KeyEntryPasswordProvider entryPasswordProvider)
Description copied from class: KeyStoreKeyingDataProvider
Gets a protection parameter to access the specified entry.

Specified by:
getKeyProtection in class KeyStoreKeyingDataProvider
Parameters:
entryAlias - the alias of the entry that is being accessed
entryCert - the cerificate in the entry
entryPasswordProvider - the password provider that should be used to get the actual password (may be null)
Returns:
the protection


Copyright © 2012. All Rights Reserved.