Package org.jscep.message

Examples of org.jscep.message.PkiMessageEncoder


    public void test404() throws Exception {
  KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();

  PkcsPkiEnvelopeEncoder envEnc = new PkcsPkiEnvelopeEncoder(
    getCertificate(keyPair), "DES");
  PkiMessageEncoder enc = new PkiMessageEncoder(keyPair.getPrivate(),
    getCertificate(keyPair), envEnc);

  TransactionId transId = TransactionId.createTransactionId();
  Nonce senderNonce = Nonce.nextNonce();
  X500Name name = new X500Name("CN=jscep.org");
  BigInteger serialNumber = BigInteger.ONE;
  IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(name,
    serialNumber);
  GetCert getCert = new GetCert(transId, senderNonce, iasn);
  PkiOperationRequest req = new PkiOperationRequest(enc.encode(getCert));

  try {
      transport.sendRequest(req, new PkiOperationResponseHandler());
  } catch (TransportException e) {
      Assert.assertEquals(e.getMessage(), "404 Not Found");
View Full Code Here


  @Test
  public void testGetCRL() throws Exception {
    IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(name, goodSerial);
    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        getRecipient(), "DESede");
    PkiMessageEncoder encoder = new PkiMessageEncoder(priKey, sender,
        envEncoder);

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
View Full Code Here

  @Test
  public void testGetCertBad() throws Exception {
    IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(name, badSerial);
    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        getRecipient(), "DES");
    PkiMessageEncoder encoder = new PkiMessageEncoder(priKey, sender,
        envEncoder);

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
View Full Code Here

    PKCS10CertificationRequest csr = getCsr(name, pubKey, priKey,
        "password".toCharArray());

    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        getRecipient(), "DESede");
    PkiMessageEncoder encoder = new PkiMessageEncoder(priKey, sender,
        envEncoder);

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
View Full Code Here

    PKCS10CertificationRequest csr = getCsr(name, pubKey, priKey,
        "password".toCharArray());

    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        getRecipient(), "DES");
    PkiMessageEncoder encoder = new PkiMessageEncoder(priKey, sender,
        envEncoder);

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
View Full Code Here

    PKCS10CertificationRequest csr = getCsr(pollName, pubKey, priKey,
        "password".toCharArray());

    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        getRecipient(), "DES");
    PkiMessageEncoder encoder = new PkiMessageEncoder(priKey, sender,
        envEncoder);

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
View Full Code Here

      }
    }
    // TRANSACTIONAL
    // Certificate enrollment
    final Transport transport = createTransport(profile);
    PkiMessageEncoder encoder = getEncoder(identity, key, profile);
    PkiMessageDecoder decoder = getDecoder(identity, key, profile);
    final EnrollmentTransaction trans = new EnrollmentTransaction(
        transport, encoder, decoder, csr);

    try {
View Full Code Here

    final Transport transport = createTransport(profile);
    CertStore store = getCaCertificate(profile);
    CertStoreInspector certStore = CertStoreInspector.getInstance(store);
    X509Certificate issuer = certStore.getIssuer();

    PkiMessageEncoder encoder = getEncoder(identity, identityKey, profile);
    PkiMessageDecoder decoder = getDecoder(identity, identityKey, profile);

    IssuerAndSubject ias = new IssuerAndSubject(X500Utils.toX500Name(issuer
        .getIssuerX500Principal()), X500Utils.toX500Name(subject));
View Full Code Here

    X509Certificate recipientCertificate = certs.getRecipient();
    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        recipientCertificate, caps.getStrongestCipher());

    String sigAlg = caps.getStrongestSignatureAlgorithm();
    return new PkiMessageEncoder(priKey, identity, envEncoder, sigAlg);
  }
View Full Code Here

    throw new ServletException("Unknown Message for Operation");
      }

      PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        reqCert, "DESede");
      PkiMessageEncoder encoder = new PkiMessageEncoder(getSignerKey(),
        getSigner(), envEncoder);
      CMSSignedData signedData;
      try {
    signedData = encoder.encode(certRep);
      } catch (MessageEncodingException e) {
    LOGGER.error("Error decoding response", e);
    throw new ServletException(e);
      }
View Full Code Here

TOP

Related Classes of org.jscep.message.PkiMessageEncoder

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.