* create a private key from the given public key info object.
*/
static PrivateKey createPrivateKeyFromPrivateKeyInfo(
PrivateKeyInfo info)
{
AlgorithmIdentifier algId = info.getAlgorithmId();
if (algId.getObjectId().equals(PKCSObjectIdentifiers.rsaEncryption))
{
return new JCERSAPrivateCrtKey(info);
}
else if (algId.getObjectId().equals(PKCSObjectIdentifiers.dhKeyAgreement))
{
return new JCEDHPrivateKey(info);
}
else if (algId.getObjectId().equals(X9ObjectIdentifiers.id_dsa))
{
return new JDKDSAPrivateKey(info);
}
else
{