Package com.sun.org.apache.xml.internal.security.exceptions

Examples of com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException


     * @throws XMLSecurityException
     */
    private void validateReference(Element referentElement) throws XMLSecurityException {
        if (!XMLUtils.elementIsInSignatureSpace(referentElement, Constants._TAG_KEYINFO)) {
            Object exArgs[] = { new QName(referentElement.getNamespaceURI(), referentElement.getLocalName()) };
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.WrongType", exArgs);
        }

        KeyInfo referent = new KeyInfo(referentElement, "");
        if (referent.containsKeyInfoReference()) {
            if (secureValidation) {
                throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithSecure");
            } else {
                // Don't support chains of references at this time. If do support in the future, this is where the code
                // would go to validate that don't have a cycle, resulting in an infinite loop. This may be unrealistic
                // to implement, and/or very expensive given remote URI references.
                throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithoutSecure");
            }
        }

    }
View Full Code Here


    */
   public void setElement(Element element, String BaseURI)
           throws XMLSecurityException {

      if (element == null) {
         throw new XMLSecurityException("ElementProxy.nullElement");
      }
      if (true) {
      }
     
      if (true) {
View Full Code Here

           throws XMLSecurityException {

      this();

      if (element == null) {
         throw new XMLSecurityException("ElementProxy.nullElement");
      }
     
      if (true) {
        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "setElement(\"" + element.getTagName() + "\", \"" + BaseURI
                + "\")");
View Full Code Here

      String namespaceIS = this._constructionElement.getNamespaceURI();
      if ( !localnameSHOULDBE.equals(localnameIS) ||
        !namespaceSHOULDBE.equals(namespaceIS)) {     
         Object exArgs[] = { namespaceIS +":"+ localnameIS,
           namespaceSHOULDBE +":"+ localnameSHOULDBE};
         throw new XMLSecurityException("xml.WrongElement", exArgs);
      }
   }
View Full Code Here

           throws XMLSecurityException {

      String ns;

      if ((prefix == null) || (prefix.length() == 0)) {
       throw new XMLSecurityException("defaultNamespaceCannotBeSetHere");
      } else if (prefix.equals("xmlns")) {
        throw new XMLSecurityException("defaultNamespaceCannotBeSetHere");
      } else if (prefix.startsWith("xmlns:")) {
         ns = prefix;//"xmlns:" + prefix.substring("xmlns:".length());
      } else {
         ns = "xmlns:" + prefix;
      }

     

      Attr a = this._constructionElement.getAttributeNodeNS(Constants.NamespaceSpecNS, ns);

      if (a != null) {
       if (!a.getNodeValue().equals(uri)) {
         Object exArgs[] = { ns,
                             this._constructionElement.getAttributeNS(null,
                                                                      ns) };

         throw new XMLSecurityException("namespacePrefixAlreadyUsedByOtherURI",
                                        exArgs);
       }
       return;
      }
View Full Code Here

       
       Object storedNamespace=ElementProxy._prefixMappings.get(namespace);
         if (!storedNamespace.equals(prefix)) {
           Object exArgs[] = { prefix, namespace, storedNamespace };

           throw new XMLSecurityException("prefix.AlreadyAssigned", exArgs);
         }
    }
      ElementProxy._prefixMappings.put(namespace, prefix);
   }
View Full Code Here

                this._constructionElement.getParentNode().replaceChild(imported,
                    this._constructionElement);

                this._constructionElement = (Element) imported;
            } catch (ParserConfigurationException ex) {
                throw new XMLSecurityException("empty", ex);
            } catch (IOException ex) {
                throw new XMLSecurityException("empty", ex);
            } catch (SAXException ex) {
                throw new XMLSecurityException("empty", ex);
            }
        }
        signatureMethod = XMLUtils.getNextElement(c14nMethod.getNextSibling());
        this._signatureAlgorithm =
            new SignatureAlgorithm(signatureMethod, this.getBaseURI());
View Full Code Here

                           : "not") + " requested to follow nested Manifests");
      }
      boolean verify = true;

      if (_referencesEl.length==0) {
         throw new XMLSecurityException("empty");
      }

      this.verificationResults =
         new boolean[_referencesEl.length];
View Full Code Here

                             Integer.toString(this.getLength()) };
         Exception e =
            new IndexOutOfBoundsException(I18n
               .translate("signature.Verification.IndexOutOfBounds", exArgs));

         throw new XMLSecurityException("generic.EmptyMessage", e);
      }

      if (this.verificationResults == null) {
         try {
            this.verifyReferences();
         } catch (Exception ex) {
            throw new XMLSecurityException("generic.EmptyMessage", ex);
         }
      }

      return this.verificationResults[index];
   }
View Full Code Here

   public byte[] getDigestValue() throws Base64DecodingException, XMLSecurityException {
      if (digestValueElement == null) {
                  // The required element is not in the XML!
                  Object[] exArgs ={ Constants._TAG_DIGESTVALUE,
                                                         Constants.SignatureSpecNS };
                  throw new XMLSecurityException(
                                        "signature.Verification.NoSignatureElement",
                                        exArgs);
          }
      byte[] elemDig = Base64.decode(digestValueElement);
      return elemDig;
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException

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.