// Verify the signature on SPKAC
String signAlgString = PKCSObjectIdentifiers.md5WithRSAEncryption.equals(alg0) ? "MD5withRSA" :
PKCSObjectIdentifiers.md2WithRSAEncryption.equals(alg0) ? "MD2withRSA" :
PKCSObjectIdentifiers.sha1WithRSAEncryption.equals(alg0) ? "SHA1withRSA" : null;
Signature signObj = Signature.getInstance(signAlgString);
signObj.initVerify(pubKey);
signObj.update(pkacSeq.getEncoded());
boolean verified = signObj.verify(signature);
if(!verified) throw new Exception("SignedPublicKeyAndChallenge verification failed.");
map.put(CERT_REQ_PUBLICKEY, pkInfo);
map.put(CERT_REQ_PUBLICKEY_OBJ, pubKey);