Class BasicCredential
java.lang.Object
se.swedenconnect.security.credential.AbstractPkiCredential
se.swedenconnect.security.credential.BasicCredential
- All Implemented Interfaces:
DisposableBean
,InitializingBean
,PkiCredential
A basic implementation of the
PkiCredential
interface.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Constructor Summary
ConstructorDescriptionDefault constructor.BasicCredential
(X509Certificate certificate, PrivateKey privateKey) Constructor setting the certificate and private key.BasicCredential
(PublicKey publicKey, PrivateKey privateKey) Constructor setting the public and private keys.BasicCredential
(List<X509Certificate> certificates, PrivateKey privateKey) Constructor setting the certificate(s) and private key.BasicCredential
(List<X509Certificate> certificates, Resource privateKey) Constructor setting the certificate(s) and private key.BasicCredential
(List<X509Certificate> certificates, Resource privateKey, char[] password) Constructor setting the certificate and an encrypted private key.BasicCredential
(Resource certificateResource, PrivateKey privateKey) Constructor setting the certificate and private key.BasicCredential
(Resource certificateResource, Resource privateKey) Constructor setting the certificate and private key.BasicCredential
(Resource certificateResource, Resource privateKey, char[] password) Constructor setting the certificate and an encrypted private key. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Gets the subject DN of the certificate and if no certificate is available an UUID is used.Methods inherited from class se.swedenconnect.security.credential.AbstractPkiCredential
afterPropertiesSet, destroy, getCertificate, getCertificateChain, getName, getPrivateKey, getPublicKey, setCertificate, setCertificate, setCertificateChain, setName, setPrivateKey, setPrivateKey, setPrivateKey, setPublicKey
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface se.swedenconnect.security.credential.PkiCredential
init, isHardwareCredential
-
Constructor Details
-
BasicCredential
public BasicCredential()Default constructor. -
BasicCredential
Constructor setting the public and private keys.- Parameters:
publicKey
- the public keyprivateKey
- the private key
-
BasicCredential
Constructor setting the certificate and private key.- Parameters:
certificate
- the certificateprivateKey
- the private key
-
BasicCredential
public BasicCredential(Resource certificateResource, PrivateKey privateKey) throws CertificateException Constructor setting the certificate and private key.- Parameters:
certificateResource
- the resource holding a encoded certificateprivateKey
- the private key- Throws:
CertificateException
- if the certificate resource can not be decoded
-
BasicCredential
public BasicCredential(Resource certificateResource, Resource privateKey) throws CertificateException, KeyException Constructor setting the certificate and private key.- Parameters:
certificateResource
- the resource holding a encoded certificateprivateKey
- the private key resource- Throws:
CertificateException
- if the certificate resource can not be decodedKeyException
- if the key decode fails
-
BasicCredential
public BasicCredential(Resource certificateResource, Resource privateKey, char[] password) throws CertificateException, KeyException Constructor setting the certificate and an encrypted private key.- Parameters:
certificateResource
- the resource holding a encoded certificateprivateKey
- the private key resourcepassword
- the private key password- Throws:
CertificateException
- if the certificate resource can not be decodedKeyException
- if the key decode fails
-
BasicCredential
Constructor setting the certificate(s) and private key.- Parameters:
certificates
- the certificate(s) where the entity certificate is placed firstprivateKey
- the private key
-
BasicCredential
Constructor setting the certificate(s) and private key.- Parameters:
certificates
- the certificate(s) where the entity certificate is placed firstprivateKey
- the private key resource- Throws:
KeyException
- if the key decode fails
-
BasicCredential
public BasicCredential(List<X509Certificate> certificates, Resource privateKey, char[] password) throws KeyException Constructor setting the certificate and an encrypted private key.- Parameters:
certificates
- the certificate(s) where the entity certificate is placed firstprivateKey
- the private key resourcepassword
- the private key password- Throws:
KeyException
- if the key decode fails
-
-
Method Details
-
getDefaultName
Gets the subject DN of the certificate and if no certificate is available an UUID is used.- Specified by:
getDefaultName
in classAbstractPkiCredential
- Returns:
- the credential name
-