Class AbstractPkiCredential

java.lang.Object
se.swedenconnect.security.credential.AbstractPkiCredential
All Implemented Interfaces:
PkiCredential
Direct Known Subclasses:
AbstractReloadablePkiCredential, BasicCredential

public abstract class AbstractPkiCredential extends Object implements PkiCredential
Abstract base class for classes implementing the PkiCredential interface.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • AbstractPkiCredential

      public AbstractPkiCredential()
      Default constructor.
  • Method Details

    • getPublicKey

      @Nonnull public PublicKey getPublicKey()
      Gets the public key.
      Specified by:
      getPublicKey in interface PkiCredential
      Returns:
      the public key
    • getStandalonePublicKey

      @Nullable protected PublicKey getStandalonePublicKey()
      If a credential without a certificate is created, this method must be overridden and return the installed PublicKey.
      Returns:
      the standalone public key, or null if a certificate is present
    • getName

      @Nonnull public String getName()
      Gets the name of the credential. If no name has been explicitly assigned, the default name is used.
      Specified by:
      getName in interface PkiCredential
      Returns:
      the name
    • setName

      public void setName(@Nonnull String name)
      Assigns the credential name.
      Parameters:
      name - the name
    • getDefaultName

      @Nonnull protected abstract String getDefaultName()
      If the credential name property is not explicitly assigned using setName(String) a name is calculated based on a credential's properties.
      Returns:
      the credential name
    • getMetadata

      @Nonnull public PkiCredential.Metadata getMetadata()
      Gets the credential metadata.
      Specified by:
      getMetadata in interface PkiCredential
      Returns:
      a (potentially empty) credential metadata object
    • updateMetadataValidityProperties

      protected void updateMetadataValidityProperties()
      Updates the metadata properties issued-at and expires-at based on the entity certificate of the credential.