Class BasicCredential

java.lang.Object
se.swedenconnect.security.credential.AbstractPkiCredential
se.swedenconnect.security.credential.BasicCredential
All Implemented Interfaces:
DisposableBean, InitializingBean, PkiCredential

public class BasicCredential extends AbstractPkiCredential
A basic implementation of the PkiCredential interface.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • BasicCredential

      public BasicCredential()
      Default constructor.
    • BasicCredential

      public BasicCredential(PublicKey publicKey, PrivateKey privateKey)
      Constructor setting the public and private keys.
      Parameters:
      publicKey - the public key
      privateKey - the private key
    • BasicCredential

      public BasicCredential(X509Certificate certificate, PrivateKey privateKey)
      Constructor setting the certificate and private key.
      Parameters:
      certificate - the certificate
      privateKey - 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 certificate
      privateKey - 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 certificate
      privateKey - the private key resource
      Throws:
      CertificateException - if the certificate resource can not be decoded
      KeyException - 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 certificate
      privateKey - the private key resource
      password - the private key password
      Throws:
      CertificateException - if the certificate resource can not be decoded
      KeyException - if the key decode fails
    • BasicCredential

      public BasicCredential(List<X509Certificate> certificates, PrivateKey privateKey)
      Constructor setting the certificate(s) and private key.
      Parameters:
      certificates - the certificate(s) where the entity certificate is placed first
      privateKey - the private key
    • BasicCredential

      public BasicCredential(List<X509Certificate> certificates, Resource privateKey) throws KeyException
      Constructor setting the certificate(s) and private key.
      Parameters:
      certificates - the certificate(s) where the entity certificate is placed first
      privateKey - 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 first
      privateKey - the private key resource
      password - the private key password
      Throws:
      KeyException - if the key decode fails
  • Method Details

    • getDefaultName

      protected String getDefaultName()
      Gets the subject DN of the certificate and if no certificate is available an UUID is used.
      Specified by:
      getDefaultName in class AbstractPkiCredential
      Returns:
      the credential name