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

Examples of org.apache.xml.security.keys.content.x509.XMLX509SubjectName


        Element e =
            XMLUtils.selectDsNode(
                getFirstChild(), Constants._TAG_X509SUBJECTNAME, i);

        if (e != null) {
            return new XMLX509SubjectName(e, this.baseURI);
        }
        return null;
    }
View Full Code Here


         this._x509childObject =
            new XMLX509SubjectName[this._x509childNodes.getLength()];

         for (int i = 0; i < this._x509childNodes.getLength(); i++) {
            this._x509childObject[i] =
               new XMLX509SubjectName((Element) this._x509childNodes.item(i),
                                      BaseURI);
         }

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

            cat.debug("Found Certificate SN: " + certSN.getSubjectName());

            for (int i = 0; i < this._x509childObject.length; i++) {
               cat.debug("Found Element SN:     "
                         + this._x509childObject[i].getSubjectName());

               if (certSN.equals(this._x509childObject[i])) {
                  cat.debug("match !!! ");

                  return cert;
               } else {
                  cat.debug("no match...");
View Full Code Here

        // SubjectName hint
        ki = new KeyInfo(doc);
        ki.addStorageResolver(storage);
        x509data = new X509Data(doc);
        x509data.add(new XMLX509SubjectName(doc, cert.getSubjectX500Principal().getName()));
        ki.add(x509data);
        assertEquals(publicKey, ki.getPublicKey());

        ki.registerInternalKeyResolver(privateKeyResolver);
        assertEquals(privateKey, ki.getPrivateKey());
View Full Code Here

         object.setId("object-4");

         X509Data x509data = new X509Data(doc);

         x509data.add(new XMLX509SubjectName(doc, cert));
         x509data.add(new XMLX509IssuerSerial(doc, cert));
         x509data.add(new XMLX509Certificate(doc, cert));
         object.appendChild(x509data.getElement());
         sig.appendObject(object);
      }
View Full Code Here

         object.setId("object-4");

         X509Data x509data = new X509Data(doc);

         x509data.add(new XMLX509SubjectName(doc, cert));
         x509data.add(new XMLX509IssuerSerial(doc, cert));
         x509data.add(new XMLX509Certificate(doc, cert));
         object.appendChild(x509data.getElement());
         sig.appendObject(object);
      }
View Full Code Here

         object.setId("object-4");

         X509Data x509data = new X509Data(doc);

         x509data.add(new XMLX509SubjectName(doc, cert));
         x509data.add(new XMLX509IssuerSerial(doc, cert));
         x509data.add(new XMLX509Certificate(doc, cert));
         object.appendChild(x509data.getElement());
         sig.appendObject(object);
      }
View Full Code Here

            object.setId("object-4");

            X509Data x509data = new X509Data(doc);

            x509data.add(new XMLX509SubjectName(doc, cert));
            x509data.add(new XMLX509IssuerSerial(doc, cert));
            x509data.add(new XMLX509Certificate(doc, cert));
            object.appendChild(x509data.getElement());
            sig.appendObject(object);
        }
View Full Code Here

    ) throws KeyResolverException {
        if (log.isDebugEnabled()) {
            log.debug("Can I resolve " + element.getTagName() + "?");
        }
        Element[] x509childNodes = null;    
        XMLX509SubjectName x509childObject[] = null;

        if (!XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_X509DATA)) {    
            if (log.isDebugEnabled()) {
                log.debug("I can't");
            }
            return null;
        }
        x509childNodes =
            XMLUtils.selectDsNodes(element.getFirstChild(), Constants._TAG_X509SUBJECTNAME);

        if (!((x509childNodes != null)
            && (x509childNodes.length > 0))) {
            if (log.isDebugEnabled()) {
                log.debug("I can't");
            }
            return null;
        }

        try {
            if (storage == null) {
                Object exArgs[] = { Constants._TAG_X509SUBJECTNAME };
                KeyResolverException ex =
                    new KeyResolverException("KeyResolver.needStorageResolver", exArgs);

                if (log.isDebugEnabled()) {
                    log.debug("", ex);
                }

                throw ex;
            }

            x509childObject = new XMLX509SubjectName[x509childNodes.length];

            for (int i = 0; i < x509childNodes.length; i++) {
                x509childObject[i] = new XMLX509SubjectName(x509childNodes[i], BaseURI);
            }

            Iterator<Certificate> storageIterator = storage.getIterator();
            while (storageIterator.hasNext()) {
                X509Certificate cert = (X509Certificate)storageIterator.next();
                XMLX509SubjectName certSN =
                    new XMLX509SubjectName(element.getOwnerDocument(), cert);

                if (log.isDebugEnabled()) {
                    log.debug("Found Certificate SN: " + certSN.getSubjectName());
                }

                for (int i = 0; i < x509childObject.length; i++) {
                    if (log.isDebugEnabled()) {
                        log.debug("Found Element SN:     "
                              + x509childObject[i].getSubjectName());
                    }

                    if (certSN.equals(x509childObject[i])) {
                        if (log.isDebugEnabled()) {
                            log.debug("match !!! ");
                        }

                        return cert;
View Full Code Here

     * Method addSubjectName
     *
     * @param subjectName
     */
    public void addSubjectName(String subjectName) {
        this.add(new XMLX509SubjectName(this.doc, subjectName));
    }
View Full Code Here

     * Method addSubjectName
     *
     * @param x509certificate
     */
    public void addSubjectName(X509Certificate x509certificate) {
        this.add(new XMLX509SubjectName(this.doc, x509certificate));
    }
View Full Code Here

TOP

Related Classes of org.apache.xml.security.keys.content.x509.XMLX509SubjectName

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.