Question

5
Replies
4073
Views
JOHNPW_GCS Member since 2009 20 posts
PEGA
Posted: 3 years ago
Last activity: 3 years 9 months ago
Closed
Solved

How to create a PRPC Page 'pxResults' type page from Java Step.

I'm trying to build an Utility to list some details of Trusted Certificates (contained in the default JVM Truststore).

Here's the code : this works - but only logs the results to the PegaRules.log - Ideally, I would like this in the form a PRPC Page (so we can do more interesting stuff with it; and also to avoid having to check the logs):

This all works within a single Java Step:

try {
javax.net.ssl.TrustManagerFactory trustManagerFactory = javax.net.ssl.TrustManagerFactory.getInstance(javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm() );
trustManagerFactory.init((java.security.KeyStore)null);
  
for (javax.net.ssl.TrustManager trustManager : trustManagerFactory.getTrustManagers() ) {
	javax.net.ssl.X509TrustManager x509TrustManager = (javax.net.ssl.X509TrustManager)trustManager;
    int i = 1;
  	for (java.security.cert.X509Certificate cert : x509TrustManager.getAcceptedIssuers()) {
                oLog.infoForced( i + ":"+cert.getIssuerX500Principal());
                i++;
            }
}

}
catch(Exception e) { throw new PRRuntimeException(e); }

 

So: as an example how could we get a PRPC Page to contain this information : assume I have a DATA CLASS which contains a Property called 'Issuer' (which would correspond to 'getIssuerX500Principal') - can somebody provide a working example of how to do this ?

(And then I can try and generalize it to include other Certificate information such as "Serial Number" [using 'getSerialNumber' of the Java API]).

Thanks,

John

 

Data Integration Java and Activities
Moderation Team has archived post
Share this page LinkedIn