I'm working on project which collect data from some government portal.
To obtain valid data I had to make request containing some exact xml data.
The xml data had also to contain public key of my certificate. The the portal then encrypts
the returned data. Having private key of the certificate I am then able to decrypt returned data. So far so good, it's working.
But how am I getting the public key of my certificate for the xml? So far manually.
I found the certificate among other personal ones in Chrome browser.
Exported it into file, without private key, X.509, coding Base-64 (CER).
Then opened the exported file in the text editor, removed '-----BEGIN CERTIFICATE-----'
and '----END CERTIFICATE-----''and the rest put into XML
This all I need to repeat by java code (BouncyCastle library ?). I think it will be easy, but the examples are scarce.
Thanks.