SubjectPublicKeyInfo subjectPKInfo = reqInfo.getSubjectPublicKeyInfo();
try
{
X509EncodedKeySpec xspec = new X509EncodedKeySpec(new DERBitString(subjectPKInfo).getBytes());
AlgorithmIdentifier keyAlg = subjectPKInfo.getAlgorithmId ();
try {
if (provider == null) {
return KeyFactory.getInstance(keyAlg.getObjectId().getId ()).generatePublic(xspec);
}
else {
return KeyFactory.getInstance(keyAlg.getObjectId().getId (), provider).generatePublic(xspec);
}
} catch (NoSuchAlgorithmException e) {
// if we can't resolve this via the OID, just as for the RSA algorithm. This is all
// Geronimo requires anyway.