code: private static OCSPReq generateOCSPRequest(X509Certificate issuerCert, BigInteger serialNumber) throws OCSPException, IOException, OperatorException, CertificateEncodingException {
          //Add provider BC
          Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
          
          JcaDigestCalculatorProviderBuilder digestCalculatorProviderBuilder = new JcaDigestCalculatorProviderBuilder();
          DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();
          DigestCalculator digestCalculator = digestCalculatorProvider.get(CertificateID.HASH_SHA1);
          // Generate the id for the certificate we are looking for
          CertificateID id = new CertificateID(digestCalculator, new JcaX509CertificateHolder(issuerCert), serialNumber);
          
          // basic request generation with nonce
          OCSPReqBuilder gen = new OCSPReqBuilder();
          
          gen.addRequest(id);
          
          // create details for nonce extension
          Extension ext = new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, new DEROctetString(new DEROctetString(PdfEncryption.createDocumentId()).getEncoded()));
          gen.setRequestExtensions(new Extensions(new Extension[]{ext}));
          
          return gen.build();
      }
docs: Generates an OCSP request using BouncyCastle.
  @param issuerCert	certificate of the issues
  @param serialNumber	serial number
  @return	an OCSP request
  @throws OCSPException
  @throws IOException