Package org.digidoc4j

Class X509Cert

java.lang.Object
org.digidoc4j.X509Cert
All Implemented Interfaces:
Serializable

public class X509Cert extends Object implements Serializable
Wrapper for java.security.cert.X509Certificate object.
See Also:
  • Constructor Details

    • X509Cert

      public X509Cert(X509Certificate cert)
      Creates a copy of the X509Certificate.
      Parameters:
      cert - X509 certificate to be wrapped
  • Method Details

    • getCertificatePolicies

      public List<String> getCertificatePolicies() throws IOException
      Returns current certificate policies or null if no policies was found.
      Returns:
      list of policies
      Throws:
      IOException - when policy parsing fails
    • getX509Certificate

      public X509Certificate getX509Certificate()
      Returns the internal X509 Certificate of the certificate.
      Returns:
      X509Certificate
    • issuerName

      public String issuerName(X509Cert.Issuer part)
      Retrieves part of the issuer name (for example if set to CN it returns the Common Name part).
      Parameters:
      part - sets part of issuer name to return
      Returns:
      part of issuer name
    • issuerName

      public String issuerName()
      Reads the the whole issuer name from the X.509 certificate.
      Returns:
      issuer name
    • isValid

      public boolean isValid(Date date)
      Validates if the certificate is in a valid time slot.
      Parameters:
      date - sets date to compare
      Returns:
      boolean indicating if the certificate is in a valid time slot
    • isValid

      public boolean isValid()
      Validates if the current time is between the certificate's validity start date and expiration date.
      Returns:
      boolean indicating if the current time is between the certificate's validity start and expiration date
    • getKeyUsages

      public List<X509Cert.KeyUsage> getKeyUsages()
      Returns the current certificate key usage.
      Returns:
      list of key usages
    • getSerial

      public String getSerial()
      Reads serial number from X.509 certificate.
      Returns:
      serial number of the X.509 certificate
    • getSubjectName

      public String getSubjectName(X509Cert.SubjectName part)
      Returns part of the subject name (for example if set to CN it returns the Common Name part).
      Parameters:
      part - sets part of subject name to return
      Returns:
      subject name
    • getSubjectName

      public String getSubjectName()
      Returns the whole subject name.
      Returns:
      subject name