Package org.apache.xml.security.signature

Examples of org.apache.xml.security.signature.XMLSignature.addKeyInfo()


        MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);

  if (cert) {
      signature.addKeyInfo(signingCert);
  } else {
      signature.addKeyInfo(publicKey);
  }

  Element nsElement = testDocument.createElementNS(null, "nsElement");
  nsElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:ds",
        Constants.SignatureSpecNS);
View Full Code Here


  Transforms transforms = new Transforms(doc);
  transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
  transforms.addTransform(Transforms.TRANSFORM_C14N_WITH_COMMENTS);
  sig.addDocument("", transforms, Constants.ALGO_ID_DIGEST_SHA1);

  sig.addKeyInfo(getPublicKey());
  sig.sign(getPrivateKey());

  // displayDocument(doc);

  return sig;
View Full Code Here

    object.setId(OBJECT_ID);

    signature.addDocument("#" + OBJECT_ID);
    signature.addDocument("", getTransforms(document));

    signature.addKeyInfo(signingCert);
    signature.sign(privateKey);
    return document;
  }

        private Transforms getTransforms(Document document) throws Exception {
View Full Code Here

      {
         //Add in the KeyInfo for the certificate that we used the private key of
         X509Certificate cert =
            (X509Certificate) ks.getCertificate(certificateAlias);

         sig.addKeyInfo(cert);
         sig.addKeyInfo(cert.getPublicKey());
         System.out.println("Start signing");
         sig.sign(privateKey);
         System.out.println("Finished signing");
      }
View Full Code Here

         //Add in the KeyInfo for the certificate that we used the private key of
         X509Certificate cert =
            (X509Certificate) ks.getCertificate(certificateAlias);

         sig.addKeyInfo(cert);
         sig.addKeyInfo(cert.getPublicKey());
         System.out.println("Start signing");
         sig.sign(privateKey);
         System.out.println("Finished signing");
      }
View Full Code Here

      {
         X509Certificate cert =
            (X509Certificate) ks.getCertificate(certificateAlias);

         sig.addKeyInfo(cert);
         sig.addKeyInfo(cert.getPublicKey());
         sig.sign(privateKey);
      }

      FileOutputStream f = new FileOutputStream(signatureFile);
View Full Code Here

      {
         X509Certificate cert =
            (X509Certificate) ks.getCertificate(certificateAlias);

         sig.addKeyInfo(cert);
         sig.addKeyInfo(cert.getPublicKey());
         sig.sign(privateKey);
      }

      FileOutputStream f = new FileOutputStream(signatureFile);
View Full Code Here

        Transforms transforms = new Transforms(doc);
        transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
        transforms.addTransform(Transforms.TRANSFORM_C14N_WITH_COMMENTS);
        sig.addDocument("", transforms, Constants.ALGO_ID_DIGEST_SHA1);

        sig.addKeyInfo(kp.getPublic());
        sig.sign(privateKey);

        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        XMLUtils.outputDOMc14nWithComments(doc, bos);
View Full Code Here

                 XMLSignature.ALGO_ID_SIGNATURE_DSA);
       doc.appendChild(sig.getElement());
       sig.addDocument("");
           //Add in the KeyInfo for the certificate that we used the private key of          
       X509Certificate cert =getCertificate();
           sig.addKeyInfo(cert);
           sig.addKeyInfo(cert.getPublicKey());
           // Add these three lines
           org.apache.xml.security.keys.KeyInfo ki = sig.getKeyInfo();
           ki.itemX509Data(0).addSubjectName(cert.getSubjectDN().toString());
           ki.itemX509Data(0).addIssuerSerial(cert.getIssuerDN().toString(),
View Full Code Here

       doc.appendChild(sig.getElement());
       sig.addDocument("");
           //Add in the KeyInfo for the certificate that we used the private key of          
       X509Certificate cert =getCertificate();
           sig.addKeyInfo(cert);
           sig.addKeyInfo(cert.getPublicKey());
           // Add these three lines
           org.apache.xml.security.keys.KeyInfo ki = sig.getKeyInfo();
           ki.itemX509Data(0).addSubjectName(cert.getSubjectDN().toString());
           ki.itemX509Data(0).addIssuerSerial(cert.getIssuerDN().toString(),
               cert.getSerialNumber());          
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.