CertSource¶
-
public class
CertSource
¶ This class loads a X509 certificate file. Basically this class only acts as a convenience wrapper of java.security.cert.X509Certificate.
Author: kcyee
Fields¶
x509Cert¶
-
protected X509Certificate
x509Cert
¶ internal X509 certificate storage.
Constructors¶
CertSource¶
-
public
CertSource
()¶ Default constructor. The user should call load() to further initialize the certificate.
CertSource¶
CertSource¶
-
public
CertSource
(String certFile)¶ Constructor with initialization parameters. The certificate will be loaded from the file specified.
Parameters: - certFile – the file name of the certificate file
Throws: - CertificateException – if the file specified cannot be read, or any errors occurred when loading the file.
CertSource¶
-
public
CertSource
(X509Certificate cert)¶ Constructor with initialization parameters. The class will be initialized with the specified certificate.
Parameters: - cert – the preloaded certificate
Methods¶
getInternalCert¶
-
public X509Certificate
getInternalCert
()¶ Gets the X509Certificate stored internally.
Returns: the X509Certificate stored internally.
getIssuer¶
-
public String
getIssuer
()¶ Gets the distinguished name (DN) of the issuer of the certificate.
Throws: - InitializationException – the object is not yet initialized
Returns: the DN of the issuer
getPublicKey¶
isValid¶
-
public boolean
isValid
()¶ Checks whether the certificate is valid in current time.
Returns: true if the certificate is still valid, false if otherwise.
isValid¶
load¶
load¶
verify¶
verify¶
-
public boolean
verify
(Certificate cert)¶ Verifies whether the certificate is signed by the private key corresponding to public key in the specified certificate.
Parameters: - cert – the certificate for verification
Returns: true if the verification is passed, false if otherwise.
verify¶
-
public boolean
verify
(CertSource cert)¶ Verifies whether the certificate is signed by the private key corresponding to public key in the specified certificate.
Parameters: - cert – the certificate for verification
Returns: true if the verification is passed, false if otherwise.