loading public keys

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

loading public keys

Michał Zegan

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Hello.

Let's assume that I have a PEM formatted pkcs8 encrypted private key
somewhere and I try to load it.
After loading I receive the EncryptedPrivateKeyInfo that I then decrypt
and get PrivateKeyInfo that I can convert into jca's
java.security.interfaces.PrivateKey.
Now the problem is, how to derive a public key from the private key if I
do not have a separate file with it?
If it is algorithm specific then how to easily derive public key when I
hold a DSA private key? Or do I need to make calculations myself?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
 
iQIcBAEBAgAGBQJU2OOVAAoJEHb1CzgxXKwYyhQP+wZRPst5t8YOhmyZ5kY9gOb1
xa6aoXiIu+LLV96ojwziJArjfIOeU2bPfVSqEB2WgEZIa+4id5iOofsrrt2mwo6w
M8ft/HKPO1fnceO7SEACTtcxkmj1pG0eGdbiw1fU3LE/UEw73v96w7ecWo7GTLQX
0FX/Can3Sd6UIXJRzBewDKodD8fuznf/6XrxVr77J/HgOM6UFA76J6jqSpt1erwt
xA4eKBlCQjQLGpUlbHl5Ewjbc4WJK1rFblPIrSDL03SvHzbP10i+XI4S2sPFtiHe
E//GA2QbKO+OdnxuchQYwMUSkb9vjusvo3h9hrurg1R7temQIdDyYKkF8k5MhV/y
wUl4zWv2u9qVYcqetzQcyPfnYmd12pBbNYpIsllxdPhOo1Dvu8a6LGGR9/yQFAMt
+YIF1ZGs8CeF5Kx/aWL4S7DiDmKL1Fgwv1ia55HIDmK2NFB0qJ1PA63K1v9G9i1+
6/ea9d/Yx6hhT69WS+hZRWYF0nMGQ5AHngdTvq1c4BrnfZEB+xV0fiQ5L3O1N4YY
z6acQMPqr0TQl5qa1Uw0Raqbn/6UAWVyPmkx70GNiIYeEm+4JpPlQ5ICfr+a3JJV
s8Qi5pnfcQat4gH1kyvS9GIF5gfVvxoCgNY3yi/FtC9vHAcWhPZiCiAieW1cD6cO
/7GOjlVz2LyrKEYm3npI
=Vs3w
-----END PGP SIGNATURE-----


Reply | Threaded
Open this post in threaded view
|

Re: loading public keys

David Hook

It depends on the key type, some provide for storage of public key details, but in general you'll need to calculate the public key from the private value.

Regards,

David

On 10/02/15 03:43, Michał Zegan wrote:
>
Hello.

Let's assume that I have a PEM formatted pkcs8 encrypted private key
somewhere and I try to load it.
After loading I receive the EncryptedPrivateKeyInfo that I then decrypt
and get PrivateKeyInfo that I can convert into jca's
java.security.interfaces.PrivateKey.
Now the problem is, how to derive a public key from the private key if I
do not have a separate file with it?
If it is algorithm specific then how to easily derive public key when I
hold a DSA private key? Or do I need to make calculations myself?
>
>
>