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

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


      super(doc);

      try {
         this.addBase64Text(x509certificate.getEncoded());
      } catch (java.security.cert.CertificateEncodingException ex) {
         throw new XMLSecurityException("empty", ex);
      }
   }
View Full Code Here


            return cert;
         }

         return null;
      } catch (CertificateException ex) {
         throw new XMLSecurityException("empty", ex);
      }
   }
View Full Code Here

         byte[] derEncodedValue = cert.getExtensionValue(XMLX509SKI.SKI_OID);

         if (cert.getVersion() < 3) {
            Object exArgs[] = { new Integer(cert.getVersion()) };

            throw new XMLSecurityException("certificate.noSki.lowVersion",
                                           exArgs);
         }

          byte[] extensionValue = null;

          /**
           * Use sun.security.util.DerValue if it is present.
           */
          try {
                  DerValue dervalue = new DerValue(derEncodedValue);
                  if (dervalue == null) {
                      throw new XMLSecurityException("certificate.noSki.null");
                  }
                  if (dervalue.tag != DerValue.tag_OctetString) {
                      throw new XMLSecurityException("certificate.noSki.notOctetString");
                  }
                  extensionValue = dervalue.getOctetString();
          } catch (NoClassDefFoundError e) {
          }

          /**
           * Fall back to org.bouncycastle.asn1.DERInputStream
           */
          if (extensionValue == null) {
              try {
                  Class clazz = Class.forName("org.bouncycastle.asn1.DERInputStream");
                  if (clazz != null) {
                      Constructor constructor = clazz.getConstructor(new Class[]{InputStream.class});
                      InputStream is = (InputStream) constructor.newInstance(new Object[]{new ByteArrayInputStream(derEncodedValue)});
                      Method method = clazz.getMethod("readObject", new Class[]{});
                      Object obj = method.invoke(is, new Object[]{});
                      if (obj == null) {
                          throw new XMLSecurityException("certificate.noSki.null");
                      }
                      Class clazz2 = Class.forName("org.bouncycastle.asn1.ASN1OctetString");
                      if (!clazz2.isInstance(obj)) {
                          throw new XMLSecurityException("certificate.noSki.notOctetString");
                      }
                      Method method2 = clazz2.getMethod("getOctets", new Class[]{});
                      extensionValue = (byte[]) method2.invoke(obj, new Object[]{});
                  }
              } catch (Throwable t) {
              }
          }

         /**
          * Strip away first two bytes from the DerValue (tag and length)
          */
         byte abyte0[] = new byte[extensionValue.length - 2];

         System.arraycopy(extensionValue, 2, abyte0, 0, abyte0.length);

         /*
         byte abyte0[] = new byte[derEncodedValue.length - 4];
         System.arraycopy(derEncodedValue, 4, abyte0, 0, abyte0.length);
         */
         if (true)
                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Base64 of SKI is " + Base64.encode(abyte0));

         return abyte0;
      } catch (IOException ex) {
         throw new XMLSecurityException("generic.EmptyMessage", ex);
      }
   }
View Full Code Here

            ,Constants._TAG_DIGESTVALUE,0);
          if (digestValueElem == 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(digestValueElem);
      return elemDig;
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 static void main(String[] args) throws Exception {

        Locale.setDefault(Locale.ITALY);

        try {
            throw new XMLSecurityException("foo");
        } catch (XMLSecurityException xse) {
            System.out.println("Test PASSED");
        } catch (Throwable t) {
            System.out.println("Test FAILED");
            t.printStackTrace();
View Full Code Here

                             + ", "
                             + XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT
                             + " or "
                             + XPath2FilterContainer04._ATT_FILTER_VALUE_UNION };

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

                             + ", "
                             + XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT
                             + " or "
                             + XPath2FilterContainer._ATT_FILTER_VALUE_UNION };

         throw new XMLSecurityException("attributeValueIllegal", exArgs);
      }
   }
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

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.