Beyond PSD2 for a Better Open Banking Expereince

PSD2 is acting as a catalyst in the digital transformation happening in the Banking industry. While meeting the compliance requirements of PSD2, financial institutes are excited to make use of the new business models and opportunities opened by this laid foundation. More the customers and partners we can reach, more the business activities and more the revenue. Making the banking functions more accessible and reactive will be a key enabler to provide a seamless experience to these parties, including internal banking staff whom directly affects the business efficiency.
IAM plays a critical role in improving business accessibility without compromising the system boundaries. PSD2 mandates strong customer authentication(SCA), setting the bar high for user authenticity, while keeping few exemptions, not to bother payment services user(PSU) with SCA for every little transactions. While adhering to this policy will make an institute PSD2 complaint, if they can react fast to the fraud rates…

Generating Key Pairs and Importing Public Key Certificates to a Trusted Keystore

Through this I am sharing the most simple scenario to follow in using Java keytool for the requirements of Apache Wookie projects digital signature implementation. Anyway if you are looking to know how to generate a key pair or import a certificate to a Keystore using keytool, still this may be helpful. Refer this segment of Java SE documentation to know in-depth details.

You needs a configuration of Java in your computer to use keytool and that is enough :).

Generating Key Pairs

Use following command in command prompt to generate a keypair with a self-signed certificate
keytool -genkey -alias wookie -keyalg RSA -keystore wookieKeystore.jks -keysize 4096
After  -alias give the alias to be used for keys
          -keylag give the algorithm to be used in key generation
         -keystore give the name of the keystore with type .jks (You can give a path here to store the keystore in a desired place)
          -keysize give the length for the generating key in bits
This will look something as follows,

That's all and you are having a key pair now. :) 
In Aspects of Wookie, now you can sign Widgets using this keystore. But in order to get your widgets verified and deployed in Wookie server you needs to get your public key trusted by server directly or via a third party.

Generating .cer File

To insert a public key certificate into a trusted keystore it needs to be exported as a .cer file. (There are several other options to use too.)
keytool -v -export -file keystore1.cer -keystore wookieKeystore.jks -alias wookie

Importing Public Key Certificates to a Trusted Keystore

To import a trusted certificate to a trusted keystore following command can be used.
keytool -import -alias keystore1 -file keystore1.cer -keystore wookieKeystore.jks
This command simply says to import the public key certificate of key having alias 'keystore1' which is in the file keystore1.cer to the keystore 'wookieKeystore.jks'.

Now any signature generated using the private key of keystore1 aliased key pair, can be properly validated using wookieKeystore.jks.


  1. This comment has been removed by a blog administrator.

  2. are you sure the generated key pair is self-signed?

    1. Yes, it is.. You can confirm on Oracle site,

  3. keytool uses the -selfcert command to generate a self signed certificate. I am also not sure if keytool can export the public key. openssl can.

    1. Yes keytool can export the public cert as of above. Only confusion was regarding exporting the private key as a .p12 file. This is also possible with Java 7 onwards..

  4. Hi Pusphalanka,

    Can u please share the downlinked/full sample code for the Signing SOAP Messages - Generation of Enveloped XML Signatures? When I clicked to the download link its no more there in the


  5. Hello Pushpalanka,

    Do you have also verification part of "Signing SOAP Messages" available? Verification always fails :(

  6. Hi Pushpalanka .. Thanks for wonderful post... need one help .... i created jks file using the same method u suggested. Can you help me what would be the value of keystorepass, privateKeyAlias, privateKeyPass and certificateAlias required in one of the program in which you suggested how to make signed enveloped xml from xml.

    I can understand pass keystorepass and privatekeypass will be my password. But i am unable to know what are the values for privateKeyalias and certificateAlias.


Post a Comment

Popular posts from this blog

Signing SOAP Messages - Generation of Enveloped XML Signatures

How to send an HTML email in Java (Using Google SMTP Server)

Adding Custom Claims to the SAML Response - (How to Write a Custom Claim Handler for WSO2 Identity Server)