|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.attributes.MQeListCertificates
This class is used to list public certificates in a registry.
This class is a descendant of Object.
Constructor Summary | |
MQeListCertificates()
Creates an object that requires the attributes to be set with the activate() method call. |
|
MQeListCertificates(java.lang.String name,
MQeFields regParams)
Creates a object and automatically calls the activate() method. |
Method Summary | |
void |
activate(java.lang.String name,
MQeFields regParams)
Initializes the class and opens the registry. |
void |
close()
Closes the registry and tidies up. |
java.lang.String |
getIssuer(java.lang.Object certificate)
Returns the issuer field from a certificate. |
long |
getNotAfter(java.lang.Object certificate)
This returns the not after date from the certificate. |
long |
getNotBefore(java.lang.Object certificate)
This returns the not before date from the certificate. |
java.lang.String |
getSubject(java.lang.Object certificate)
Returns the Subject field from a certificate. |
java.lang.Object |
getWTLSCertificate(MQeFields entry)
Returns the certificate from a registry entry. |
MQeFields |
readAllEntries()
Reads all the certificate entries in the registry. |
MQeFields |
readEntry(java.lang.String certName)
Reads a specific certificate entry in the registry. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MQeListCertificates()
Creates an object that requires the attributes to be set with the activate() method call.
public MQeListCertificates(java.lang.String name, MQeFields regParams) throws MQeException
Creates a object and automatically calls the activate() method.
name
- The name associated with this registry.regParams
- An MQeFields
object containing the
initialization parameters for the registry:
The same separator character should be used every time a registry is opened, it should not be changed once a registry is in use and contains entries.
If this value is not specified it defaults to +.
This parameter can be null for a public registry whose name is MQeNode_PublicRegistry , otherwise this parameter must be non-null.
MQeException
- MQeListCertificates list1; list1 = new MQeListCertificates(); try { MQeListCertificates list2; MQeFields parms = new MQeFields(); parms.putAscii(MQeRegistry.DirName, "Registry_Dir"); list2 = new MQeListCertificates("Reg2", parms); } catch (Exception e) {// handle the exception here }
Method Detail |
public void activate(java.lang.String name, MQeFields regParams) throws MQeException
Initializes the class and opens the registry.
name
- The registry nameregParams
- MQeFields object containing startup parameters as specified
in the constructor detalis.
MQeException
- as specified in the constructor details.try { MQeListCertificates list1; MQeFields parms = new MQeFields(); parms.putAscii(MQeRegistry.DirName, "Registry_Dir"); list1 = new MQeListCertificates(); list1.activate("Reg1", parms); } catch (Exception e) {// handle the exception here }
public MQeFields readAllEntries() throws MQeException
Reads all the certificate entries in the registry.
This reads all the registry entries for certificates and returns them
in an MQeFields
object.
MQeFields
object containing one field for
each certificate in the registry.The name of a field is the name of the
certificate and the value of the field is itself an MQeFields
object containing the certificate. For example, if the registry contains two
certificates, the MQeFields object contains two fields, each of which is an
MQeFields
object containing a certificate.
MQeException
- MQeFields certificates = null; try { MQeListCertificates list1; MQeFields parms = new MQeFields(); parms.putAscii(MQeRegistry.DirName, "Registry_Dir"); list1 = new MQeListCertificates("Reg1", parms); certificates = list1.readAllEntries(); } catch (Exception e) {// Handle the exception here } return certificates;
public MQeFields readEntry(java.lang.String certName) throws MQeException
Reads a specific certificate entry in the registry.
This reads a specific certificate entry in the registry and returns it in a
MQeFields
object.
certName
- The name of the certificate to be read.
MQeFields
object containing the registry entry for
the certificate. This can be passed to the getWTLSCertificate() method.
If the certificate does not exist in the registry, null is returned.
MQeException
- MQeFields certificate = null; try { MQeListCertificates list1; MQeFields parms = new MQeFields(); parms.putAscii(MQeRegistry.DirName, "Registry_Dir"); list1 = new MQeListCertificates("Reg1", parms); certificate = list1.readEntry("Reg1"); } catch (Exception e) {// Handle the exception here } return certificate;
public java.lang.Object getWTLSCertificate(MQeFields entry)
Returns the certificate from a registry entry.
entry
- An MQeFields
object containing the
registry entry. This could be one of the embedded fields objects returned
by readAllEntries(), or it could be a fields object returned by
readEntry().
If the registry entry does not contain a certificate, null is returned.
public Object USeGetWTLSCertificate(MQeFields entry) { Object cert = null; try { MQeListCertificates list1 = new MQeListCertificates("Reg1", entry); MQeFields certificates = list1.readAllEntries(); Enumeration enum = certificates.fields(); while (enum.hasMoreElements()) { //get the name of the certificate String entity = (String) enum.nextElement(); //get the certificate's registry entry MQeFields certEntry = certificates.getFields(entity); //get the certificate object cert = list1.getWTLSCertificate(certEntry); } } catch (Exception e) {// Handle the exception here } return cert; }
public java.lang.String getSubject(java.lang.Object certificate)
Returns the Subject field from a certificate.
This returns the subject string from the certificate.
certificate
- An object representing a cetificate, as returned by
getWTLSCertificate().
public String UseGetSubject(Object certificate) { String subject = null; try { MQeFields params = new MQeFields(); MQeListCertificates list1 = new MQeListCertificates("Reg1", params); MQeFields certificates = list1.readAllEntries(); Enumeration enum = certificates.fields(); while (enum.hasMoreElements()) { //get the name of the certificate String entity = (String) enum.nextElement(); //get the certificate's registry entry MQeFields certEntry = certificates.getFields(entity); //get the certificate object Object cert = list1.getWTLSCertificate(certEntry); subject = list1.getSubject(cert); System.out.println("certificate " + entity + "subject is " + subject); } } catch (Exception e) {// Handle the exception here } return subject; }
public java.lang.String getIssuer(java.lang.Object certificate)
Returns the issuer field from a certificate.
certificate
- An object representing a cetificate, as returned by
getWTLSCertificate().
public String UseGetIssuer(Object certificate) { String issuer = null; try { MQeFields parms = new MQeFields(); MQeListCertificates list1 = new MQeListCertificates("Reg1", parms); MQeFields certificates = list1.readAllEntries(); Enumeration enum = certificates.fields(); while (enum.hasMoreElements()) { //get the name of the certificate String entity = (String) enum.nextElement(); //get the certificate's registry entry MQeFields certEntry = certificates.getFields(entity); //get the certificate object Object cert = list1.getWTLSCertificate(certEntry); issuer = list1.getSubject(cert); System.out.println("certificate " + entity + "issuer is " + issuer); } } catch (Exception e) {// Handle the exception here } return issuer; }
public long getNotBefore(java.lang.Object certificate)
This returns the not before date from the certificate.
That is the date before which the certificate is invalid.
certificate
- An object representing a cetificate, as returned by
getWTLSCertificate().
If there are any errors retrieving the date, -1 is returned.
public long UseGetNotBefore(Object certificate) { long notBefore = 0L; try { MQeListCertificates list1 = new MQeListCertificates("MQeNode_PublicRegistry", null); MQeFields certEntry = list1.readEntry("myCert"); //get the certificate object Object cert = list1.getWTLSCertificate(certEntry); notBefore = list1.getNotBefore(cert); System.out.println("certificate invalid before " + new Date(notBefore * 1000)); } catch (Exception e) {// Handle the exception here } return notBefore; }
public long getNotAfter(java.lang.Object certificate)
This returns the not after date from the certificate. That is the date after which the certificate is invalid.
certificate
- An object representing a cetificate, as returned by
getWTLSCertificate().
If there are any errors retrieving the date, -1 is returned.
public long UseGetNotAfter(Object certificate) { long notAfter = 0L; try { MQeListCertificates list1 = new MQeListCertificates("MQeNode_PublicRegistry", null); MQeFields certEntry = list1.readEntry("myCert"); //get the certificate object Object cert = list1.getWTLSCertificate(certEntry); notAfter = list1.getNotBefore(cert); System.out.println("certificate invalid after " + new Date(notAfter * 1000)); } catch (Exception e) {// Handle the exception here } return notAfter; }
public void close()
Closes the registry and tidies up.
This closes the registry and frees up resources.
try { MQeListCertificates list1 = new MQeListCertificates("MQeNode_PublicRegistry", null); MQeFields certEntry = list1.readEntry("myCert"); //get the certificate object Object cert = list1.getWTLSCertificate(certEntry); long notBefore = list1.getNotBefore(cert); System.out.println("certificate invalid before " + new Date(notBefore * 1000)); list1.close(); } catch (Exception e) {// Handle the exception here }
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |