Examples of addKeyInfo()


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

                    .getCertificate(certificateAlias);
                if(cert.equals(null)){
                    throw new NullPointerException();
                }
                sig.addKeyInfo(cert);
                sig.addKeyInfo(cert.getPublicKey());

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

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

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


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

            Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
            byte[] canonicalMessage = c14n.canonicalizeSubtree(doc);
View Full Code Here

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

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


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

            Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
            byte[] canonicalMessage = c14n.canonicalizeSubtree(doc);
View Full Code Here

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

        XMLSignature xmlSig = new XMLSignature(doc, "", XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
        Transforms transforms = new Transforms(doc);
        transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
        transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
        xmlSig.addDocument("#" + xKMSServiceReq.getId(), transforms, Constants.ALGO_ID_DIGEST_SHA1);             
        xmlSig.addKeyInfo(signerCert);
        doc.getDocumentElement().insertBefore(xmlSig.getElement() ,doc.getDocumentElement().getFirstChild());
        xmlSig.sign(xKMSkey);
            returnval = new XKMSCAServiceResponse(doc);
          } catch (XMLSignatureException e) {
            throw new ExtendedCAServiceRequestException(e);
View Full Code Here

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

        } else {
            sig = prepareEnvelopedSignature(doc, id, referenceId, sigAlgo);
        }
       
       
        sig.addKeyInfo(issuerCerts[0]);
        sig.addKeyInfo(issuerCerts[0].getPublicKey());
        sig.sign(privateKey);
        return sig.getElement().getOwnerDocument();
    }
   
View Full Code Here

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

            sig = prepareEnvelopedSignature(doc, id, referenceId, sigAlgo);
        }
       
       
        sig.addKeyInfo(issuerCerts[0]);
        sig.addKeyInfo(issuerCerts[0].getPublicKey());
        sig.sign(privateKey);
        return sig.getElement().getOwnerDocument();
    }
   
    private XMLSignature prepareEnvelopingSignature(Document doc,
View Full Code Here

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

      transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);

      sig.addDocument("#" + id, transforms, Constants.ALGO_ID_DIGEST_SHA1);

      if (this.certChain != null && this.certChain.length > 0) {
        sig.addKeyInfo(certChain);
      } else {
        sig.addKeyInfo(this.cert);
      }

      sig.sign(this.privateKey);
View Full Code Here

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

      sig.addDocument("#" + id, transforms, Constants.ALGO_ID_DIGEST_SHA1);

      if (this.certChain != null && this.certChain.length > 0) {
        sig.addKeyInfo(certChain);
      } else {
        sig.addKeyInfo(this.cert);
      }

      sig.sign(this.privateKey);

      return sig.getElement();
View Full Code Here

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

                    .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);

            signature.addDocument(elementRefId, transforms,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);

            signature.addKeyInfo(signCert);
            signature.addKeyInfo(signCert.getPublicKey());

            signature.sign(signKey);

        } catch (XMLSecurityException xmse) {
View Full Code Here

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

            signature.addDocument(elementRefId, transforms,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);

            signature.addKeyInfo(signCert);
            signature.addKeyInfo(signCert.getPublicKey());

            signature.sign(signKey);

        } catch (XMLSecurityException xmse) {
            throw new XKMSException(xmse);
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.