Code example for X509Certificate

Methods: getSerialNumber

0
        s.update(authed.getDerEncoding());
        byte[] sig = s.sign();
 
        SignerInfo signerInfo = new SignerInfo(
                n,
                cert.getSerialNumber(),
                AlgorithmId.get("SHA-256"), 
                authed,
                AlgorithmId.get("SHA256withRSA"), 
                sig,
                null 
                ); 
 
        PKCS7 pkcs7 = new PKCS7(
                new AlgorithmId[] {signerInfo.getDigestAlgorithmId()},
                new ContentInfo(data),
                new X509Certificate[] {cert},
                new SignerInfo[] {signerInfo});
 
        if (pkcs7.verify(signerInfo, data) == null) {
            throw new Exception("Not verified");