|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.openoces.ooapi.cert.OcesCertificateFactory
This is a singleton class used to construct OCES certificates. Use this class to instantiate high-level OcesCertificate objects from a raw X.509 OCES certificate.
The following example instantiates a certificate object given a PEM encoded certificate.
// assume cPEM contains the PEM encoded certificate
String cPEM;
OcesCertificate oc = OcesCertificateFactory.getInstance().generate(cPEM);
After construction you may assert that the certificate is signed by the OCES root certificate. No other validation occurs automatically.
It it also possible to instantiate a certificate object from a DER encoded certificate available in a byte array:
// assume bs contains the DER encoded certificate
byte[] bs;
OcesCertificate oc = OcesCertificateFactory.getInstance().generate(bs);
In case you already have a X509Certificate object, you can also use that to instantiate an OcesCertificate object:
// assume x509c contains an OCES certificate
X509Certificate x509c;
OcesCertificate oc = OcesCertificateFactory.getInstance().generate(x509c);
In all cases the type of the returned certificate will be of one:
You typically use aninstanceof expression to determine the exact type:
// assume bs contains the DER encoded certificate
byte[] bs;
OcesCertificate oc = OcesCertificateFactory.getInstance().generate(bs);
if ( oc instanceof PersonalOcesCertificate ) {
// handle personal OCES certificate case
} else if ( oc instanceof EmployeeOcesCertificate ) {
// handle employee OCES certiticate case
} else if ( oc instanceof OrganizationalOcesCertificate ) {
// handle organizational OCES certificate case
}
| Field Summary | |
protected java.security.cert.CertificateFactory |
cf
the X.509 cerficate factory used to instantiate X.509 certificate objects |
| Method Summary | |
OcesCertificate |
generate(byte[] derEncodedCertificate)
Constructs an OcesCertificate object from a raw PEM encoded X.509 OCES certificate. |
OcesCertificate |
generate(java.lang.String pemEncodedCertificate)
Constructs an OcesCertificate object from a raw PEM encoded X.509 OCES certificate. |
OcesCertificate |
generate(java.security.cert.X509Certificate certObj)
Constructs an OcesCertificate object from X509Certificate object. |
protected OcesCertificate |
generateFromObject(java.security.cert.X509Certificate crt)
|
static OcesCertificateFactory |
getInstance()
Returns the singleton factory object |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.security.cert.CertificateFactory cf
| Method Detail |
public static OcesCertificateFactory getInstance()
public OcesCertificate generate(java.lang.String pemEncodedCertificate)
throws InternalException,
NonOcesCertificateException,
SignatureVerificationException
OcesCertificate object from a raw PEM encoded X.509 OCES certificate. The method will
verify that the passed X.509 certificate has been signed by the OCES root certificate and throw an exception if
this is not the case. No other processing of the certificate is being done. Before trusting the certificate, you
should use the RevocationChecker class to verify the validity of the
certificate.
pemEncodedCertificate - a PEM encoded X.509 certificate
InternalException - if an internal error occurred. Please report this
NonOcesCertificateException - if the specified certificate is not recognized as an OCES certificate
SignatureVerificationException - if the key is incorrectOcesCertificate,
RevocationChecker
public OcesCertificate generate(java.security.cert.X509Certificate certObj)
throws InternalException,
NonOcesCertificateException,
SignatureVerificationException
OcesCertificate object from X509Certificate object. The method will
verify that the passed X.509 certificate has been signed by the OCES root certificate and throw an exception if
this is not the case. No other processing of the certificate is being done. Before trusting the certificate, you
should use the RevocationChecker class to verify the validity of the
certificate.
certObj - a X.509 object
InternalException - if an internal error occurred. Please report this
NonOcesCertificateException - if the specified certificate is not recognized as an OCES certificate
SignatureVerificationException - if the key is incorrectOcesCertificate,
RevocationChecker
protected OcesCertificate generateFromObject(java.security.cert.X509Certificate crt)
throws InternalException,
SignatureVerificationException,
NonOcesCertificateException
InternalException
SignatureVerificationException
NonOcesCertificateException
public OcesCertificate generate(byte[] derEncodedCertificate)
throws InternalException,
NonOcesCertificateException,
SignatureVerificationException
OcesCertificate object from a raw PEM encoded X.509 OCES certificate. The method will
verify that the passed X.509 certificate has been signed by the OCES root certificate and throw an exception if
this is not the case. No other processing of the certificate is being done. Before trusting the certificate, you
should use the RevocationChecker class to verify the validity of the
certificate.
derEncodedCertificate - a DER encoded X.509 certificate
InternalException - if an internal error occurred. Please report this
NonOcesCertificateException - if the specified certificate is not recognized as an OCES certificate
SignatureVerificationException - if the key is incorrectOcesCertificate,
RevocationChecker
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||