List keys' expiration date

Hi folks,

I was able to list the “trust stores” certificates expiration dates using the tips from Flow/JAVA service to list all client certificates.

Now, the challenge is to list the expiration date from the keys. I’ve found the way up to retrieving the keys… in binary format. Is there any service to “unabridge” it?
Here is how the service looks so far:

LOOP over /keyStoreAliasNames
   LOOP over /keyStore/configuredKeyAliases

However, this last INVOKE produces privateKey and certChain[].

Please note the objective is to produce a report of the key expiration date.
Any hint?

I suspect you’ll need a java service at this point, though I honestly haven’t gone digging through the services to see if there is one there.

  • privateKey =
  • certChain[ ] = Array of byte[].

You’ll need a java service to do something like the following:

IDataCursor pipelineCursor = pipeline.getCursor();
Object	key = IDataUtil.get( pipelineCursor, "key" );
Object[]	certChain = IDataUtil.getObjectArray( pipelineCursor, "certChain" );

//Private Key
PrivateKey pkey = (PrivateKey)key;
System.out.println("Algorithm : " + pkey.getAlgorithm());
System.out.println("Format    : " + pkey.getFormat());
System.out.println("Encoded   : " + pkey.getEncoded());

//Cert chain (example working on first one only)
byte[] b = (byte[]) certChain[0];

try {
       InputStream in = new ByteArrayInputStream(b);
       CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
       X509Certificate cert = (X509Certificate)certFactory.generateCertificate(in);
       System.out.println(cert.getNotAfter()); //Returns Date Obj set to expiry date
       //See here for methods on X509 Cert.
catch (CertificateException e) {

Hi @Dave_Pemberton,

Thanks for your time. I’ll give this a try, and revert back.

Hi @Dave_Pemberton,
Thanks for pointing me the right direction.