public class PKCS11NoTestCredential extends PKCS11Credential
BasicX509Credential
and provides simple credentials for PKCS#11
keys based on one or more configured providers.
This is a simplified extension of the PKCS11Credential class, which do not attempt to reload the key in case the connection to the key in the PKCS"11 token has been disrupted or lost.
privateKeyMap
Constructor and Description |
---|
PKCS11NoTestCredential(X509Certificate entityCertificate,
List<String> providerNameList,
String alias,
CustomKeyExtractor customKeyExtractor)
Initializes the PKCS#11 credential.
|
PKCS11NoTestCredential(X509Certificate entityCertificate,
List<String> providerNameList,
String alias,
String pin)
Initializes the PKCS#11 credential.
|
Modifier and Type | Method and Description |
---|---|
PrivateKey |
getPrivateKey()
Overrides the default method to get an random available private key from any of the configured PKCS#11 providers.
|
getCurrentKeyProvider, getRandomProviderFromPool
getCredentialType, getCRLs, getEntityCertificate, getEntityCertificateChain, getPublicKey, getSecretKey, setCRLs, setEntityCertificate, setEntityCertificateChain, setPublicKey, setSecretKey
setEntityId, setPrivateKey, setUsageType
getCredentialContextSet, getEntityId, getKeyNames, getUsageType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCredentialContextSet, getEntityId, getKeyNames, getUsageType
public PKCS11NoTestCredential(X509Certificate entityCertificate, List<String> providerNameList, String alias, CustomKeyExtractor customKeyExtractor) throws Exception
entityCertificate
- the entity certificate for this credentialproviderNameList
- the name of the security provider holding the private key objectalias
- the alias of the private keycustomKeyExtractor
- the custom key extractor for extracting the PrivateKey handler object from the providersUnrecoverableKeyException
- if the private key can not be recoveredNoSuchAlgorithmException
- if the selected algorithm is not supportedKeyStoreException
- general keystore exceptionNoSuchProviderException
- if no provider for PKCS11 is availableIOException
- general IO errorsException
public PKCS11NoTestCredential(X509Certificate entityCertificate, List<String> providerNameList, String alias, String pin) throws Exception
entityCertificate
- the entity certificate for this credentialproviderNameList
- the name of the security provider holding the private key objectalias
- the alias of the private keypin
- the pin for the private keyUnrecoverableKeyException
- if the private key can not be recoveredNoSuchAlgorithmException
- if the selected algorithm is not supportedKeyStoreException
- general keystore exceptionNoSuchProviderException
- if no provider for PKCS11 is availableIOException
- general IO errorsException
public PrivateKey getPrivateKey()
getPrivateKey
in interface Credential
getPrivateKey
in class PKCS11Credential
Copyright © 2018 Sweden Connect. All rights reserved.