Package org.bouncycastle.pkcs

Examples of org.bouncycastle.pkcs.PKCS10CertificationRequest


    assertThat(s, is(State.CERT_ISSUED));
  }

  @Test
  public void testEnrollmentWithPoll() throws Exception {
    PKCS10CertificationRequest csr = getCsr(pollName, pubKey, priKey,
        "password".toCharArray());

    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        getRecipient(), "DES");
    PkiMessageEncoder encoder = new PkiMessageEncoder(priKey, sender,
View Full Code Here


      // SCEP servers usually require a challenge password
      csrBuilder.addAttribute(
          PKCSObjectIdentifiers.pkcs_9_at_challengePassword,
          new DERPrintableString(new String("password".toCharArray())));
      ContentSigner signer = signerBuilder.build(entityPair.getPrivate());
      PKCS10CertificationRequest csr = csrBuilder.build(signer);
 
      // Send the enrollment request
      EnrollmentResponse response = client
          .enrol(id, idPair.getPrivate(), csr);
      if (response.isFailure()) {
View Full Code Here

  @Test
  public void testRenewalEnrollAllowed() throws Exception {
    // Ignore this test if the CA doesn't support renewal.
    Assume.assumeTrue(client.getCaCapabilities().isRenewalSupported());

    PKCS10CertificationRequest csr = getCsr(
        identity.getSubjectX500Principal(), keyPair.getPublic(),
        keyPair.getPrivate(), password);
    client.enrol(identity, keyPair.getPrivate(), csr);
  }
View Full Code Here

    client.enrol(identity, keyPair.getPrivate(), csr);
  }

  @Test
  public void testEnroll() throws Exception {
    PKCS10CertificationRequest csr = getCsr(
        identity.getSubjectX500Principal(), keyPair.getPublic(),
        keyPair.getPrivate(), password);
    client.enrol(identity, keyPair.getPrivate(), csr);
  }
View Full Code Here

    } catch (Exception e) {
        LOGGER.error("Error executing GetCRL request", e);
        throw new ServletException(e);
    }
      } else if (msgType == MessageType.PKCS_REQ) {
    final PKCS10CertificationRequest certReq = (PKCS10CertificationRequest) msgData;

    try {
        LOGGER.debug("Invoking doEnrol");
        List<X509Certificate> issued = doEnrol(certReq, transId);
View Full Code Here

    IssuerAndSerialNumber messageData = IssuerAndSerialNumber
      .getInstance(decoded);
    LOGGER.debug("Finished decoding pkiMessage");
    return new GetCrl(transId, senderNonce, messageData);
      } else {
    PKCS10CertificationRequest messageData;
    try {
        messageData = new PKCS10CertificationRequest(decoded);
    } catch (IOException e) {
        throw new MessageDecodingException(e);
    }
    LOGGER.debug("Finished decoding pkiMessage");
    return new PkcsReq(transId, senderNonce, messageData);
View Full Code Here

        return null;
    }

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

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

    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

            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

        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

TOP

Related Classes of org.bouncycastle.pkcs.PKCS10CertificationRequest

Copyright © 2018 www.massapicom. 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.