Class X509Utils
java.lang.Object
se.swedenconnect.security.credential.utils.X509Utils
Utility methods for working with X.509 certificates and CRL:s.
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Method Summary
Modifier and TypeMethodDescriptionstatic X509Certificate
decodeCertificate
(byte[] encoding) Decodes aX509Certificate
from its encoding.static X509Certificate
decodeCertificate
(InputStream stream) Decodes aX509Certificate
from an input stream.static X509Certificate
decodeCertificate
(Resource resource) Decodes aX509Certificate
from a resource.static X509CRL
decodeCrl
(byte[] encoding) Decodes aX509CRL
from its encoding.static X509CRL
decodeCrl
(InputStream stream) Decodes aX509CRL
from an input stream.static X509CRL
Decodes aX509CRL
from a resource.static String
toLogString
(X509Certificate certificate) TheCertificate.toString()
prints way too much for a normal log entry.
-
Method Details
-
decodeCertificate
Decodes aX509Certificate
from its encoding.- Parameters:
encoding
- the certificate encoding- Returns:
- a X509Certificate object
- Throws:
CertificateException
- for decoding errors
-
decodeCertificate
Decodes aX509Certificate
from an input stream.The method does not close the input stream.
- Parameters:
stream
- the stream to read- Returns:
- a X509Certificate object
- Throws:
CertificateException
- for decoding errors
-
decodeCertificate
Decodes aX509Certificate
from a resource.- Parameters:
resource
- the resource to read- Returns:
- a X509Certificate object
- Throws:
CertificateException
- for decoding errors
-
decodeCrl
Decodes aX509CRL
from its encoding.- Parameters:
encoding
- the CRL encoding- Returns:
- a X509CRL object
- Throws:
CRLException
- for decoding errors
-
decodeCrl
Decodes aX509CRL
from an input stream.The method does not close the input stream.
- Parameters:
stream
- the stream to read- Returns:
- a X509CRL object
- Throws:
CRLException
- for decoding errors
-
decodeCrl
Decodes aX509CRL
from a resource.- Parameters:
resource
- the resource to read- Returns:
- a X509CRL object
- Throws:
CRLException
- for decoding errors
-
toLogString
TheCertificate.toString()
prints way too much for a normal log entry. This method displays the subject, issuer and serial number.- Parameters:
certificate
- the certificate to log- Returns:
- a log string
-