// Verify signature properties
AlgorithmIdentifier algId = msg.getMessage().getProtectedPart().getHeader().getProtectionAlg();
String oid = algId.getObjectId().getId();
assertEquals(PKCSObjectIdentifiers.sha1WithRSAEncryption.getId(), oid);
// Check that we have DERNull and not plain java null as algorithm parameters.
DEREncodable pp = algId.getParameters();
assertNotNull(pp);
assertEquals(DERNull.class.getName(), pp.getClass().getName());
// Try to verify message protection
// Does not work for this Huawei message, is it signed by the same key as in the request at all?
// We will wait for another huawei message to test
//PublicKey pubKey = msg.getRequestPublicKey();
//assertTrue(CmpMessageHelper.verifyCertBasedPKIProtection(msg.getMessage(), pubKey));
// Read the CertConf (certificate confirmation) CMP message that the client sends to
// the CA after receiving the certificate. RFC4210 section "5.3.18. Certificate Confirmation Content".
in = new ASN1InputStream(huaweicertconf);
derObject = in.readObject();
PKIMessage certconf = PKIMessage.getInstance(derObject);
//log.info(certconf.toString());
GeneralCmpMessage conf = new GeneralCmpMessage(certconf);
// Verify signature properties
algId = conf.getMessage().getProtectedPart().getHeader().getProtectionAlg();
oid = algId.getObjectId().getId();
assertEquals(PKCSObjectIdentifiers.sha1WithRSAEncryption.getId(), oid);
// Check that we have DERNull and not plain java null as algorithm parameters.
pp = algId.getParameters();
assertNotNull(pp);
assertEquals(DERNull.class.getName(), pp.getClass().getName());
// Try to verify message protection
// Does not work for this Huawei message, is it signed by the same key as in the request at all?
// We will wait for another huawei message to test
//PublicKey pubKey = msg.getRequestPublicKey();
//assertTrue(CmpMessageHelper.verifyCertBasedPKIProtection(msg.getMessage(), pubKey));