[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] decrypt() and getPrivateKeyInfo() actually return a PrivateKey ??



The documentation on class EncryptedPrivateKeyInfo says that the methods
:
decrypt() and getPrivateKeyInfo() return a PrivateKeyInfo.

However, I have observed that they actually return a PrivateKey, not a
PrivateKeyInfo.
You need an additional casting to PrivateKeyInfo if you need one. See eg
below.

PrivateKeyInfo prKeyInfo1 = (PrivateKeyInfo)epki.decrypt("This is the
passphrase!");

PrivateKeyInfo prKeyInfo2 = (PrivateKeyInfo)epki.getPrivateKeyInfo();

class iaik.pkcs.pkcs8.PrivateKeyInfo implements
    iaik.asn1.ASN1Type,
    java.security.PrivateKey,
    java.io.Serializable


If the intention is to actually return a PrivateKeyInfo object, I think
the code
needs to be corrected. Pl comment/correct if I am wrong.

Rgds

Sundar Krishnan




--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-jce