Methods Summary |
---|
public abstract void | checkValidity()Checks whether the certificate is currently valid.
The validity defined in ASN.1:
validity Validity
Validity ::= SEQUENCE {
notBefore CertificateValidityDate,
notAfter CertificateValidityDate }
CertificateValidityDate ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime }
|
public abstract void | checkValidity(java.util.Date date)Checks whether the certificate is valid at the specified date.
|
public static final javax.security.cert.X509Certificate | getInstance(java.io.InputStream inStream)Creates a new {@code X509Certificate} and initializes it from the
specified input stream.
if (inStream == null) {
throw new CertificateException(Messages.getString("security.87")); //$NON-NLS-1$
}
if (constructor != null) {
try {
return (X509Certificate)
constructor.newInstance(new Object[] {inStream});
} catch (Throwable e) {
throw new CertificateException(e.getMessage());
}
}
final java.security.cert.X509Certificate cert;
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$
cert = (java.security.cert.X509Certificate)
cf.generateCertificate(inStream);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
return new X509Certificate() {
public byte[] getEncoded() throws CertificateEncodingException {
try {
return cert.getEncoded();
} catch (java.security.cert.CertificateEncodingException e) {
throw new CertificateEncodingException(e.getMessage());
}
}
public void verify(PublicKey key) throws CertificateException,
NoSuchAlgorithmException, InvalidKeyException,
NoSuchProviderException, SignatureException {
try {
cert.verify(key);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
}
public void verify(PublicKey key, String sigProvider)
throws CertificateException,
NoSuchAlgorithmException, InvalidKeyException,
NoSuchProviderException, SignatureException {
try {
cert.verify(key, sigProvider);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
}
public String toString() {
return cert.toString();
}
public PublicKey getPublicKey() {
return cert.getPublicKey();
}
public void checkValidity() throws CertificateExpiredException,
CertificateNotYetValidException {
try {
cert.checkValidity();
} catch (java.security.cert.CertificateNotYetValidException e) {
throw new CertificateNotYetValidException(e.getMessage());
} catch (java.security.cert.CertificateExpiredException e) {
throw new CertificateExpiredException(e.getMessage());
}
}
public void checkValidity(Date date)
throws CertificateExpiredException,
CertificateNotYetValidException {
try {
cert.checkValidity(date);
} catch (java.security.cert.CertificateNotYetValidException e) {
throw new CertificateNotYetValidException(e.getMessage());
} catch (java.security.cert.CertificateExpiredException e) {
throw new CertificateExpiredException(e.getMessage());
}
}
public int getVersion() {
return 2;
}
public BigInteger getSerialNumber() {
return cert.getSerialNumber();
}
public Principal getIssuerDN() {
return cert.getIssuerDN();
}
public Principal getSubjectDN() {
return cert.getSubjectDN();
}
public Date getNotBefore() {
return cert.getNotBefore();
}
public Date getNotAfter() {
return cert.getNotAfter();
}
public String getSigAlgName() {
return cert.getSigAlgName();
}
public String getSigAlgOID() {
return cert.getSigAlgOID();
}
public byte[] getSigAlgParams() {
return cert.getSigAlgParams();
}
};
|
public static final javax.security.cert.X509Certificate | getInstance(byte[] certData)Creates a new {@code X509Certificate} and initializes it from the
specified byte array.
if (certData == null) {
throw new CertificateException(Messages.getString("security.88")); //$NON-NLS-1$
}
ByteArrayInputStream bais = new ByteArrayInputStream(certData);
return getInstance(bais);
|
public abstract java.security.Principal | getIssuerDN()Returns the {@code issuer} (issuer distinguished name) as an
implementation specific {@code Principal} object.
The ASN.1 definition of {@code issuer}:
issuer Name
Name ::= CHOICE {
RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
type AttributeType,
value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
|
public abstract java.util.Date | getNotAfter()Returns the {@code notAfter} date of the validity period of the
certificate.
|
public abstract java.util.Date | getNotBefore()Returns the {@code notBefore} date from the validity period of the
certificate.
|
public abstract java.math.BigInteger | getSerialNumber()Returns the {@code serialNumber} of the certificate.
The ASN.1 definition of {@code serialNumber}:
CertificateSerialNumber ::= INTEGER
|
public abstract java.lang.String | getSigAlgName()Returns the name of the algorithm for the certificate signature.
|
public abstract java.lang.String | getSigAlgOID()Returns the OID of the signature algorithm from the certificate.
|
public abstract byte[] | getSigAlgParams()Returns the parameters of the signature algorithm in DER-encoded format.
|
public abstract java.security.Principal | getSubjectDN()Returns the {@code subject} (subject distinguished name) as an
implementation specific {@code Principal} object.
The ASN.1 definition of {@code subject}:
subject Name
Name ::= CHOICE {
RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
type AttributeType,
value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
|
public abstract int | getVersion()Returns the certificates {@code version} (version number).
The version defined is ASN.1:
Version ::= INTEGER { v1(0), v2(1), v3(2) }
|