Package org.apache.xml.security.keys.content

Examples of org.apache.xml.security.keys.content.X509Data


      try
      {
        Document oDoc = new DocumentImpl();
        KeyInfo oKeyInfo = new KeyInfo(oDoc);
        X509Data oData = new X509Data(oDoc);
        oData.addCertificate(oCertChain[oCertChain.length - 1]);
        oKeyInfo.add(oData);
        msKeyInfo = DOMUtils.toString(oKeyInfo.getElement(), false, true);
      }
      catch (Exception oEx)
      {
View Full Code Here


        KeyInfo oKeyInfo = null;
        if (moCertChain != null)
        {
            Document oDoc = new DocumentImpl();
            oKeyInfo = new KeyInfo(oDoc);
            X509Data oData = new X509Data(oDoc);
            oData.addCertificate(moCertChain[0]);
            oKeyInfo.add(oData);
            oAuthority.setKeyInfo(oKeyInfo);
        }

        return oAuthority;
View Full Code Here

    try
    {
      Document oDoc = new DocumentImpl();
      KeyInfo oKeyInfo = new KeyInfo(oDoc);
      X509Data oData = new X509Data(oDoc);
      oData.addCertificate(oCertChain[oCertChain.length - 1]);
      oKeyInfo.add(oData);
      msKeyInfo = DOMUtils.toString(oKeyInfo.getElement(), false, true);
    }
    catch (Exception oEx)
    {
View Full Code Here

      X509Certificate[] samlCertChain = this.getCertificateChain();

      Document oDoc = new DocumentImpl();
      KeyInfo oKeyInfo = new KeyInfo(oDoc);
      X509Data oData = new X509Data(oDoc);
      oData.addCertificate(samlCertChain[samlCertChain.length - 1]);
      oKeyInfo.add(oData);
      this.samlKeyInfo = DOMUtils.toString(oKeyInfo.getElement(), false, true);
    } catch (Exception oEx) {

      log.warn("Unable to create TrustedServer KeyInfo object for local authorities");
View Full Code Here

                        KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
                        ks.load(is, "password".toCharArray());
                        arr[0] = (X509Certificate)ks.getCertificate("issuercert");
                        Document oDoc = new DocumentImpl();
                        KeyInfo oKeyInfo = new KeyInfo(oDoc);
                        X509Data oData = new X509Data(oDoc);
                        oData.addCertificate(arr[0]);
                        oKeyInfo.add(oData);
                        srv.setKeyInfo(oKeyInfo);
                       
                        srv.setProviderId("@!E459.819D.771.7990!5B62.6F13.7602.5176");
                    } catch (Exception e) {
View Full Code Here

    try
    {
      Document oDoc = new DocumentImpl();
      KeyInfo oKeyInfo = new KeyInfo(oDoc);
      X509Data oData = new X509Data(oDoc);
      oData.addCertificate(oCertChain[oCertChain.length - 1]);
      oKeyInfo.add(oData);
      this.keyInfo = DOMUtils.toString(oKeyInfo.getElement(), false, true);
    }
    catch (Exception oEx)
    {
View Full Code Here

      X509Certificate[] samlCertChain = this.getCertificateChain();

      Document oDoc = new DocumentImpl();
      KeyInfo oKeyInfo = new KeyInfo(oDoc);
      X509Data oData = new X509Data(oDoc);
      oData.addCertificate(samlCertChain[samlCertChain.length - 1]);
      oKeyInfo.add(oData);
      this.samlKeyInfo = DOMUtils.toString(oKeyInfo.getElement(), false, true);
    } catch (Exception oEx) {

      log.warn("Unable to create TrustedServer KeyInfo object for local authorities");
View Full Code Here

     * @param cert Certificate to be included. This should be the certificate of
     * the key that was used to sign.
     * @throws XMLSecurityException
     */
    public void addKeyInfo(X509Certificate cert) throws XMLSecurityException {
        X509Data x509data = new X509Data(getDocument());

        x509data.addCertificate(cert);
        this.getKeyInfo().add(x509data);
    }
View Full Code Here

            break;

        case WSConstants.ISSUER_SERIAL:
            XMLX509IssuerSerial data = new XMLX509IssuerSerial(document,
                    remoteCert);
            X509Data x509Data = new X509Data(document);
            x509Data.add(data);
            secToken.setX509IssuerSerial(x509Data);
            break;

        case WSConstants.BST_DIRECT_REFERENCE:
            Reference ref = new Reference(document);
View Full Code Here

           Element element, String BaseURI, StorageResolver storage)
              throws KeyResolverException {
   if (log.isDebugEnabled())
       log.debug("Can I resolve " + element.getTagName() + "?");

    X509Data x509data = null;
    try {
       x509data = new X509Data(element, BaseURI);
     } catch (XMLSignatureException ex) {
        log.debug("I can't");
         return null;
     } catch (XMLSecurityException ex) {
        log.debug("I can't");
          return null;
     }

     if (x509data == null) {
        log.debug("I can't");
        return null;
     }

     if (!x509data.containsIssuerSerial()) {
              return null;
     }
      try {
         if (storage == null) {
            Object exArgs[] = { Constants._TAG_X509ISSUERSERIAL };
            KeyResolverException ex =
               new KeyResolverException("KeyResolver.needStorageResolver",
                                        exArgs);

            log.info("", ex);
            throw ex;
         }
        
         int noOfISS = x509data.lengthIssuerSerial();

         while (storage.hasNext()) {
            X509Certificate cert = storage.next();
            XMLX509IssuerSerial certSerial = new XMLX509IssuerSerial(element.getOwnerDocument(), cert);

            if (log.isDebugEnabled()) {
              log.debug("Found Certificate Issuer: "
                      + certSerial.getIssuerName());
              log.debug("Found Certificate Serial: "
                      + certSerial.getSerialNumber().toString());
            }

            for (int i=0; i<noOfISS; i++) {
               XMLX509IssuerSerial xmliss = x509data.itemIssuerSerial(i);

               if (log.isDebugEnabled()) {
                     log.debug("Found Element Issuer:     "
                         + xmliss.getIssuerName());
                     log.debug("Found Element Serial:     "
View Full Code Here

TOP

Related Classes of org.apache.xml.security.keys.content.X509Data

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.