Package org.jboss.ws.extensions.security

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


/*     */   }
/*     */
/*     */   public void referenceToken(BinarySecurityToken token) throws WSSecurityException
/*     */   {
/* 100 */     if (!(token instanceof X509Token)) {
/* 101 */       throw new WSSecurityException("X509IssuerSerial tried to reference something besides an X509 token");
/*     */     }
/* 103 */     X509Token x509 = (X509Token)token;
/* 104 */     X509Certificate cert = x509.getCert();
/*     */
/* 106 */     this.issuer = cert.getIssuerDN().toString();
View Full Code Here


/* 40 */     if ("X509Data".equals(name))
/*    */     {
/* 42 */       return new X509IssuerSerial(element);
/*    */     }
/*    */
/* 46 */     throw new WSSecurityException("Unkown reference element: " + name);
/*    */   }
View Full Code Here

/*  77 */       cipher = XMLCipher.getInstance();
/*  78 */       key = cipher.loadEncryptedKey(element);
/*     */     }
/*     */     catch (XMLSecurityException e)
/*     */     {
/*  82 */       throw new WSSecurityException("Could not parse encrypted key: " + e.getMessage(), e);
/*     */     }
/*     */
/*  85 */     KeyInfo info = key.getKeyInfo();
/*     */
/*  87 */     if (info == null) {
/*  88 */       throw new WSSecurityException("EncryptedKey element did not contain KeyInfo");
/*     */     }
/*  90 */     PrivateKey privateKey = resolver.resolvePrivateKey(info);
/*     */
/*  95 */     Element referenceList = Util.findElement(element, "ReferenceList", "http://www.w3.org/2001/04/xmlenc#");
/*  96 */     if (referenceList == null) {
/*  97 */       throw new WSSecurityException("Encrypted key did not contain a reference list");
/*     */     }
/*  99 */     this.list = new ReferenceList(referenceList);
/*     */
/* 102 */     String alg = getKeyAlgorithm(element);
/* 103 */     if (alg == null) {
/* 104 */       throw new WSSecurityException("Could not determine encrypted key algorithm!");
/*     */     }
/*     */     try
/*     */     {
/* 108 */       cipher.init(4, privateKey);
/* 109 */       this.secretKey = ((SecretKey)cipher.decryptKey(key, alg));
/*     */     }
/*     */     catch (XMLSecurityException e)
/*     */     {
/* 113 */       throw new WSSecurityException("Could not parse encrypted key: " + e.getMessage(), e);
/*     */     }
/*     */
/* 116 */     this.document = element.getOwnerDocument();
/* 117 */     this.token = new X509Token(resolver.resolveCertificate(info), this.document);
/*     */   }
View Full Code Here

/* 158 */       cipher.init(3, this.token.getCert().getPublicKey());
/* 159 */       key = cipher.encryptKey(this.document, this.secretKey);
/*     */     }
/*     */     catch (XMLSecurityException e)
/*     */     {
/* 163 */       throw new WSSecurityException("Error encrypting key: " + e.getMessage(), e);
/*     */     }
/*     */
/* 166 */     SecurityTokenReference reference = new SecurityTokenReference(new DirectReference(this.document, this.token));
/* 167 */     KeyInfo keyInfo = new KeyInfo(this.document);
/* 168 */     keyInfo.addUnknownElement(reference.getElement());
View Full Code Here

/*    */   {
/* 45 */     String valueType = element.getAttribute("ValueType");
/* 46 */     if ("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3".equals(valueType)) {
/* 47 */       return new X509Token(element);
/*    */     }
/* 49 */     throw new WSSecurityException("Unkown Binary Security Token!!!");
/*    */   }
View Full Code Here

      if (id != null && id.length() > 0)
         setId(id);

      Element child = Util.getFirstChildElement(element);
      if (child == null || ! Constants.WSSE_NS.equals(child.getNamespaceURI()) || ! "Username".equals(child.getLocalName()))
         throw new WSSecurityException("Username child expected in UsernameToken element");

      this.username = XMLUtils.getFullTextChildrenFromElement(child);

      child = Util.getNextSiblingElement(child);
      if (child == null || ! Constants.WSSE_NS.equals(child.getNamespaceURI()) || ! "Password".equals(child.getLocalName()))
         throw new WSSecurityException("Password child expected in UsernameToken element");

      this.password = XMLUtils.getFullTextChildrenFromElement(child);
   }
View Full Code Here

TOP

Related Classes of org.jboss.ws.extensions.security.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.