Examples of PKCS10CertificationRequest


Examples of org.bouncycastle.jce.PKCS10CertificationRequest

        // Send certificate request for a server generated PKCS12
        setupUser(SecConst.TOKEN_SOFT_BROWSERGEN);

        // Create a PKCS10 request
        KeyPair rsakeys = KeyTools.genKeys("512", "RSA");
        PKCS10CertificationRequest req = new PKCS10CertificationRequest("SHA1WithRSA", CertTools.stringToBcX509Name("C=SE, O=AnaTom, CN=foo"), rsakeys.getPublic(), new DERSet(), rsakeys.getPrivate());
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        DEROutputStream dOut = new DEROutputStream(bOut);
        dOut.writeObject(req);
        dOut.close();
        String p10 = new String(Base64.encode(bOut.toByteArray()));
View Full Code Here

Examples of org.bouncycastle.jce.PKCS10CertificationRequest

    final String password = "foo12345";
   
    // Create request
    final KeyPair keys = KeyTools.genKeys("512", AlgorithmConstants.KEYALGORITHM_RSA);
    final byte[] requestData = new String("-----BEGIN CERTIFICATE REQUEST-----\n"
        + new String(Base64.encode(new PKCS10CertificationRequest("SHA1WithRSA",
                    CertTools.stringToBcX509Name("CN=oneshot-dummyname"), keys.getPublic(), null, keys.getPrivate()).getEncoded()))
        + "\n-----END CERTIFICATE REQUEST-----").getBytes();
   
    final CertificateRequestRequest request = new CertificateRequestRequest(
        requestId,
View Full Code Here

Examples of org.bouncycastle.jce.PKCS10CertificationRequest

    KeyPair rsakeys = KeyTools.genKeys("512", AlgorithmConstants.KEYALGORITHM_RSA);         
    BigInteger serno = SernoGenerator.instance().getSerno();
    log.debug("serno: " + serno);

    PKCS10CertificationRequest req = new PKCS10CertificationRequest("SHA1WithRSA",
        CertTools.stringToBcX509Name("C=SE, O=AnaTom, CN=foo"), rsakeys.getPublic(), new DERSet(),
        rsakeys.getPrivate());

    PKCS10RequestMessage p10 = new PKCS10RequestMessage(req);
    p10.setUsername("foo");
View Full Code Here

Examples of org.bouncycastle.jce.PKCS10CertificationRequest

    KeyPair rsakeys = KeyTools.genKeys("512", AlgorithmConstants.KEYALGORITHM_RSA);
    BigInteger serno = ((X509Certificate) certificateStoreSession.findCertificatesByUsername(admin, "foo").iterator().next()).getSerialNumber();
    log.debug("foo serno: " + serno);

    PKCS10CertificationRequest req = new PKCS10CertificationRequest("SHA1WithRSA",
        CertTools.stringToBcX509Name("C=SE, O=AnaTom, CN=foo2"), rsakeys.getPublic(), new DERSet(),
        rsakeys.getPrivate());

    PKCS10RequestMessage p10 = new PKCS10RequestMessage(req);
    p10.setUsername("foo2");
View Full Code Here

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest

    return null;
  }

  public PKCS10CertificationRequest parse(String s) {
    PKCS10CertificationRequest key = null;

    if (key == null) {
      try {
        key = parsePemFormat(s);
      } catch (Exception e) {
View Full Code Here

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest

  private PKCS10CertificationRequest parsePemFormat(String data) throws IOException {
    PemReader reader = new PemReader(new StringReader(data));
    PemObject pemObject = reader.readPemObject();
    reader.close();

    PKCS10CertificationRequest csr = new PKCS10CertificationRequest(pemObject.getContent());
    return csr;
  }
View Full Code Here

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest

      signer = sigBuild.build(BouncyCastleHelpers.toAsymmetricKeyParameter(keyPair.getPrivate()));
    } catch (OperatorCreationException e) {
      throw new IllegalArgumentException("Error building content signer", e);
    }

    PKCS10CertificationRequest csrHolder = csrBuilder.build(signer);

    return new Csr(csrHolder);
  }
View Full Code Here

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest

    return new Csr(csrHolder);
  }

  public static Csr parse(String encoded) {
    CsrParser parser = new CsrParser();
    PKCS10CertificationRequest csr = parser.parse(encoded);
    if (csr == null) {
      throw new IllegalArgumentException("Cannot parse CSR");
    }

    return new Csr(csr);
View Full Code Here

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest

  // }
  // }

  public X509Certificate signCsr(String csr) throws OpsException {
    try {
      PKCS10CertificationRequest csrHolder = parseCsr(csr);
      return signCsr(csrHolder);
    } catch (IOException e) {
      throw new OpsException("Error reading CSR", e);
    }
  }
View Full Code Here

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest

  private static PKCS10CertificationRequest parseCsr(String csr) throws IOException {
    PemReader reader = new PemReader(new StringReader(csr));
    PemObject pemObject = reader.readPemObject();
    reader.close();

    PKCS10CertificationRequest csrHolder = new PKCS10CertificationRequest(pemObject.getContent());
    return csrHolder;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.