System.out.println("CertificationRequest '"+reqfile+"' generated succefully.");
System.out.println("CertificationRequest '"+reqfile+"' generated successfully.");
    protected void makeCertRequest(String dn, KeyPair rsaKeys, String reqfile) throws NoSuchAlgorithmException, IOException, NoSuchProviderException, InvalidKeyException, SignatureException {        debug(">makeCertRequest: dn='"+dn+"', reqfile='"+reqfile+"'.");        PKCS10CertificationRequest req = new PKCS10CertificationRequest(        "SHA1WithRSA", CertTools.stringToBcX509Name(dn), rsaKeys.getPublic(), null, rsaKeys.getPrivate());        /* We don't use these uneccesary attributes        DERConstructedSequence kName = new DERConstructedSequence();        DERConstructedSet  kSeq = new DERConstructedSet();        kName.addObject(PKCSObjectIdentifiers.pkcs_9_at_emailAddress);        kSeq.addObject(new DERIA5String("foo@bar.se"));        kName.addObject(kSeq);        req.setAttributes(kName);         */        ByteArrayOutputStream bOut = new ByteArrayOutputStream();        DEROutputStream dOut = new DEROutputStream(bOut);        dOut.writeObject(req);        dOut.close();        PKCS10CertificationRequest req2 =          new PKCS10CertificationRequest(bOut.toByteArray());        boolean verify = req2.verify();        System.out.println("Verify returned " + verify);        if (verify == false) {            System.out.println("Aborting!");            return;        }        FileOutputStream os1 = new FileOutputStream(reqfile);        os1.write("-----BEGIN CERTIFICATE REQUEST-----\n".getBytes());        os1.write(Base64.encode(bOut.toByteArray()));        os1.write("\n-----END CERTIFICATE REQUEST-----\n".getBytes());        os1.close();        System.out.println("CertificationRequest '"+reqfile+"' generated succefully.");        debug("<makeCertRequest: dn='"+dn+"', reqfile='"+reqfile+"'.");    } // makeCertRequest