Package org.digidoc4j
Class X509Cert
java.lang.Object
org.digidoc4j.X509Cert
- All Implemented Interfaces:
Serializable
Wrapper for java.security.cert.X509Certificate object.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Issuer parts.static enum
Key usage.static enum
Subject Name parts. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns current certificate policies or null if no policies was found.Returns the current certificate key usage.Reads serial number from X.509 certificate.Returns the whole subject name.Returns part of the subject name (for example if set to CN it returns the Common Name part).Returns the internal X509 Certificate of the certificate.Reads the the whole issuer name from the X.509 certificate.issuerName
(X509Cert.Issuer part) Retrieves part of the issuer name (for example if set to CN it returns the Common Name part).boolean
isValid()
Validates if the current time is between the certificate's validity start date and expiration date.boolean
Validates if the certificate is in a valid time slot.
-
Constructor Details
-
X509Cert
Creates a copy of the X509Certificate.- Parameters:
cert
- X509 certificate to be wrapped
-
-
Method Details
-
getCertificatePolicies
Returns current certificate policies or null if no policies was found.- Returns:
- list of policies
- Throws:
IOException
- when policy parsing fails
-
getX509Certificate
Returns the internal X509 Certificate of the certificate.- Returns:
- X509Certificate
-
issuerName
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
Reads the the whole issuer name from the X.509 certificate.- Returns:
- issuer name
-
isValid
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
Returns the current certificate key usage.- Returns:
- list of key usages
-
getSerial
Reads serial number from X.509 certificate.- Returns:
- serial number of the X.509 certificate
-
getSubjectName
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
Returns the whole subject name.- Returns:
- subject name
-