Package org.jboss.ws.extensions.security.exception

Examples of org.jboss.ws.extensions.security.exception.WSSecurityException


   }

   public SecurityTokenReference(Element element) throws WSSecurityException
   {
      if (! "SecurityTokenReference".equals(element.getLocalName()))
         throw new WSSecurityException("SecurityTokenReference was passed an invalid local name");

      String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID);
      if (id == null || id.length() == 0)
         setId(id);

      Element child = Util.getFirstChildElement(element);
      if (child == null)
         throw new WSSecurityException("Invalid message, SecurityTokenRefence is empty: " + id);

      this.reference = Reference.getReference(child);
   }
View Full Code Here


         list.add(id);
         cipher.doFinal(message, element, target.isContent());
      }
      catch (Exception e)
      {
         throw new WSSecurityException("Error encrypting target: " + name, e);
      }
   }
View Full Code Here

         kgen.init(alg.size);
         return kgen.generateKey();
      }
      catch (NoSuchAlgorithmException e)
      {
         throw new WSSecurityException(e.getMessage());
      }
   }
View Full Code Here

         cipher = XMLCipher.getInstance(algorithms.get(algorithm).xmlName);
         cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
      }
      catch (XMLSecurityException e)
      {
         throw new WSSecurityException("Error initializing xml cipher" + e.getMessage(), e);
      }

      ReferenceList list = new ReferenceList();

      if (targets == null || targets.size() == 0)
View Full Code Here

      X509Certificate cert = null;
      if (alias != null)
      {
         cert = store.getCertificate(alias);
         if (cert == null)
            throw new WSSecurityException("Cannot load certificate from keystore; alias = " + alias);
      }
      else
      {
         List<PublicKey> publicKeys = SignatureKeysAssociation.getPublicKeys();
         if (publicKeys != null && publicKeys.size() == 1)
            cert = store.getCertificateByPublicKey(publicKeys.iterator().next());
         if (cert == null)
            throw new WSSecurityException("Cannot get the certificate for message encryption! Verify the keystore contents, " +
                "considering the certificate is obtained through the alias specified in the encrypt configuration element " +
                "or (server side only) through a single key used to sign the incoming message.");
      }
      return cert;
   }
View Full Code Here

      {
         return false;
      }
      catch (Exception e)
      {
         throw new WSSecurityException("Error probing cryptographic permissions", e);
      }
   }
View Full Code Here

   public DirectReference(Element element) throws WSSecurityException
   {
      this.doc = element.getOwnerDocument();

      if (!"Reference".equals(element.getLocalName()))
         throw new WSSecurityException("Invalid message, invalid local name on a DirectReference");

      String uri = element.getAttribute("URI");
      if (uri == null || uri.length() == 0)
         throw new WSSecurityException("Inavliad message, Reference element is missing a URI");

      setUri(uri);

      String valueType = element.getAttribute("ValueType");
      if (valueType == null || valueType.length() == 0)
         throw new WSSecurityException("Inavliad message, Reference element is missing a ValueType");

      setValueType(valueType);
   }
View Full Code Here

   private SecurityTokenReference extractSecurityTokenReference(KeyInfo info) throws WSSecurityException
   {
      Element child = Util.getFirstChildElement(info.getElement());
      if (child == null)
         throw new WSSecurityException("Empty KeyInfo");

      if (! child.getLocalName().equals("SecurityTokenReference"))
         throw new WSSecurityException("KeyInfo did not contain expected SecurityTokenReference, instead got: " + child.getLocalName());

      return new SecurityTokenReference(child);
   }
View Full Code Here

   public X509Certificate resolveCertificate(SecurityTokenReference reference) throws WSSecurityException
   {
      BinarySecurityToken token = resolve(reference);

      if (! (token instanceof X509Token))
         throw new WSSecurityException("Expected X509Token, cache contained: " + token.getClass().getName());

      return ((X509Token)token).getCert();
   }
View Full Code Here

      String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID);
      if (id != null && id.length() > 0)
         setId(id);

      if (! Constants.BASE64_ENCODING_TYPE.equals(element.getAttribute("EncodingType")))
         throw new WSSecurityException("Invalid encoding type (only base64 is supported) for token:" + id);

      setCert(decodeCert(XMLUtils.getFullTextChildrenFromElement(element)));
   }
View Full Code Here

TOP

Related Classes of org.jboss.ws.extensions.security.exception.WSSecurityException

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.