Examples of DerivedKeyInfo


Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

                        SecurityContextToken secContextTk =
                            ConversationUtil.getSCT(dkToken);
                        uuid = secContextTk.getIdentifier();
                        log.debug(
                            "ConversationEngine :: The uuid is found " + uuid);
                        DerivedKeyInfo dkInfo = new DerivedKeyInfo(dkToken);
                        dkcbHandler.addDerivedKey(uuid, dkInfo);
                    } else { ///i.e. dkToken has a STR
                        SecurityTokenReference str2Base =
                            dkToken.getSecuityTokenReference();
                        if (str2Base.containsReference()) {
                            Reference ref2Base = str2Base.getReference();

                            if (ref2Base
                                .getValueType()
                                .equals("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID")) {
                                /* ok now I have a SAML token. What should I do ?
                                 * -Decrypt the secret.
                                 * -create tempUUID
                                 * -add the scTInfo into dkcbHandler
                                 * -add the derived key token to dkcbHandler.
                                 */
                               uuid = ref2Base.getURI();
                            if(dkcbHandler.getSession(uuid)==null){
                        byte[] key = handleSAML(ref2Base.getElement().getOwnerDocument(), uuid);
                   System.out.println("I am here :-)");
                   SecurityContextInfo sctInfo = new SecurityContextInfo(
                                     uuid,
                                     key,
                                     1);
                   dkcbHandler.addSecurtiyContext(
                                     uuid,
                                     sctInfo);
                 }
                  DerivedKeyInfo dkInfo = new DerivedKeyInfo(dkToken);
                  dkcbHandler.addDerivedKey(uuid, dkInfo);
                            }



                            //TODO :: Add other tokens else if
                        } else if(str2Base.containsKeyIdentifier()){
                          Element elem = str2Base.getFirstElement();
                          //.getKeyIdentifier()System.out.println("KeyIdentifier :: He ehee ........");
              String value = elem.getAttribute("ValueType");
              if("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID".equals(value)){
                uuid = ((Text)elem.getChildNodes().item(0)).getNodeValue();
                if(dkcbHandler.getSession(uuid)==null){
                     byte[] key = handleSAML(elem.getOwnerDocument(), uuid);
                     System.out.println("UUID of SAML is"+uuid);
                     SecurityContextInfo sctInfo = new SecurityContextInfo(
                                                     uuid,
                                                     key,
                                                     1);
                     dkcbHandler.addSecurtiyContext(uuid,sctInfo);
                }
                DerivedKeyInfo dkInfo = new DerivedKeyInfo(dkToken);
                dkcbHandler.addDerivedKey(uuid, dkInfo);
              }

                        }else{
                            throw new ConversationException("Cannot handle this type of security token reference: " + dkToken.getSecuityTokenReference().getReference().getValueType());
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

             * We will support security context tokens.
             */
            QName el = new QName(token.getNamespaceURI(), token.getLocalName());
            if (el.equals(DERIVEDKEY_TOKEN)) {
                DerivedKeyToken dkToken = new DerivedKeyToken(token);
                DerivedKeyInfo dkInfo = null;

        String uuid = null;

                try {
          if (dkToken.getSecuityTokenReference() == null) {
            //if dkToken doesn't have a STR
            SecurityContextToken secContextTk =
              ConversationUtil.getSCT(dkToken);
            uuid = secContextTk.getIdentifier();
            log.debug(
              "ConversationEngine :: The uuid is found " + uuid);
            dkInfo = new DerivedKeyInfo(dkToken);
            dkcbHandler.addDerivedKey(uuid, dkInfo);
          } else { ///i.e. dkToken has a STR
            SecurityTokenReference str2Base =
              dkToken.getSecuityTokenReference();
            if (str2Base.containsReference()) {
              Reference ref2Base = str2Base.getReference();
                          //TODO:: Find where can I find the constants.
              if (ref2Base
                .getValueType()
                .equals("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID")) {
                /* ok now I have a SAML token. What should I do ?
                 * -Decrypt the secret.
                 * -create tempUUID
                 * -add the scTInfo into dkcbHandler
                 * -add the derived key token to dkcbHandler.
                 */
                uuid = ref2Base.getURI();
                if(dkcbHandler.getSession(uuid)==null){
                  byte[] key = handleSAML(docSig, uuid);
                  System.out.println("I am here :-)");
                  SecurityContextInfo sctInfo =
                  new SecurityContextInfo(
                    uuid,
                    key,
                    1);
                  dkcbHandler.addSecurtiyContext(
                    uuid,
                  sctInfo);
                }
                  dkInfo = new DerivedKeyInfo(dkToken);
                  dkcbHandler.addDerivedKey(uuid, dkInfo);
                }
            } else if(str2Base.containsKeyIdentifier()){
                          Element elem = str2Base.getFirstElement();
                          //.getKeyIdentifier()System.out.println("KeyIdentifier :: He ehee ........");
                          String value = elem.getAttribute("ValueType");
                if("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID".equals(value)){
                  uuid = ((Text)elem.getChildNodes().item(0)).getNodeValue();
                  if(dkcbHandler.getSession(uuid)==null){
                     byte[] key = handleSAML(elem.getOwnerDocument(), uuid);
                     System.out.println("UUID of SAML is"+uuid);
                     SecurityContextInfo sctInfo = new SecurityContextInfo(uuid,key,1);
                     dkcbHandler.addSecurtiyContext(uuid,sctInfo);
                  }
                dkInfo = new DerivedKeyInfo(dkToken);
                dkcbHandler.addDerivedKey(uuid, dkInfo);
                }

            } else {
              throw new ConversationException("Don't know how to process here");
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

    if(keyLen!=-1){
       dtoken.setLength(doc,keyLen);
    }
       
        //step 3 :add the derived key token infomation into the dkcbHandler
        DerivedKeyInfo dkInfo = null;
        try {
            dkInfo = new DerivedKeyInfo(dtoken);
            dkInfo.setSecTokRef2DkToken(stRef);
            dkcbHandler.addDerivedKey(uuid, dkInfo);
        } catch (WSSecurityException e) {
            e.printStackTrace();
            throw new ConversationException("ConversationManager:: Cannot add Derived key token to the envelope");
        }
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

    if(keyLen!=-1){
       dtoken.setLength(doc,keyLen);
    }
       
        //step 3 :add the derived key token infomation into the dkcbHandler
        DerivedKeyInfo dkInfo = null;
        try {
            dkInfo = new DerivedKeyInfo(dtoken);
            dkInfo.setSecTokRef2DkToken(stRef);
            dkcbHandler.addDerivedKey(uuid, dkInfo);
        } catch (WSSecurityException e) {
            e.printStackTrace();
            throw new ConversationException("ConversationManager:: Cannot add Derived key token to the envelope");
        }
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

    private byte[] deriveKey(ConversationSession convSession,
                             String derivedKeyTokenId) throws
            WSSecurityException, ConversationException {

        //The derived key info object of the current derived key
        DerivedKeyInfo dkInfo = (DerivedKeyInfo) convSession.getDerivedKeys().get(derivedKeyTokenId);
        SecurityTokenReference secTokRef = dkInfo.getSecurityTokenReference();
        log.debug("KeyDerivator: deriveKey: security token reference: " + secTokRef);
//        if (secTokRef != null) {
//            if (secTokRef.toString().equals("<wsse:SecurityTokenReference/>")) {//No security token reference
//                log.debug("KeyDerivator: deriveKey: No security token refernece available");
//                return deriveTokenFromContext(convSession, dkInfo);
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

                        SecurityContextToken secContextTk =
                            ConversationUtil.getSCT(dkToken);
                        uuid = secContextTk.getIdentifier();
                        log.debug(
                            "ConversationEngine :: The uuid is found " + uuid);
                        DerivedKeyInfo dkInfo = new DerivedKeyInfo(dkToken);
                        dkcbHandler.addDerivedKey(uuid, dkInfo);
                    } else { ///i.e. dkToken has a STR
                        SecurityTokenReference str2Base =
                            dkToken.getSecuityTokenReference();
                        if (str2Base.containsReference()) {
                            Reference ref2Base = str2Base.getReference();

                            if (ref2Base
                                .getValueType()
                                .equals("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID")) {
                                /* ok now I have a SAML token. What should I do ?
                                 * -Decrypt the secret.
                                 * -create tempUUID
                                 * -add the scTInfo into dkcbHandler
                                 * -add the derived key token to dkcbHandler.
                                 */
                               uuid = ref2Base.getURI();
                            if(dkcbHandler.getSession(uuid)==null){
                        byte[] key = handleSAML(ref2Base.getElement().getOwnerDocument(), uuid);
                   System.out.println("I am here :-)");
                   SecurityContextInfo sctInfo = new SecurityContextInfo(
                                     uuid,
                                     key,
                                     1);
                   dkcbHandler.addSecurtiyContext(
                                     uuid,
                                     sctInfo);
                 }
                  DerivedKeyInfo dkInfo = new DerivedKeyInfo(dkToken);
                  dkcbHandler.addDerivedKey(uuid, dkInfo);
                            }



                            //TODO :: Add other tokens else if
                        } else if(str2Base.containsKeyIdentifier()){
                          Element elem = str2Base.getFirstElement();
                          //.getKeyIdentifier()System.out.println("KeyIdentifier :: He ehee ........");
              String value = elem.getAttribute("ValueType");
              if("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID".equals(value)){
                uuid = ((Text)elem.getChildNodes().item(0)).getNodeValue();
                if(dkcbHandler.getSession(uuid)==null){
                     byte[] key = handleSAML(elem.getOwnerDocument(), uuid);
                     System.out.println("UUID of SAML is"+uuid);
                     SecurityContextInfo sctInfo = new SecurityContextInfo(
                                                     uuid,
                                                     key,
                                                     1);
                     dkcbHandler.addSecurtiyContext(uuid,sctInfo);
                }
                DerivedKeyInfo dkInfo = new DerivedKeyInfo(dkToken);
                dkcbHandler.addDerivedKey(uuid, dkInfo);
              }

                        }else{
                            throw new ConversationException("Cannot handle this type of security token reference: " + dkToken.getSecuityTokenReference().getReference().getValueType());
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

             * We will support security context tokens.
             */
            QName el = new QName(token.getNamespaceURI(), token.getLocalName());
            if (el.equals(DERIVEDKEY_TOKEN)) {
                DerivedKeyToken dkToken = new DerivedKeyToken(token);
                DerivedKeyInfo dkInfo = null;

        String uuid = null;

                try {
          if (dkToken.getSecuityTokenReference() == null) {
            //if dkToken doesn't have a STR
            SecurityContextToken secContextTk =
              ConversationUtil.getSCT(dkToken);
            uuid = secContextTk.getIdentifier();
            log.debug(
              "ConversationEngine :: The uuid is found " + uuid);
            dkInfo = new DerivedKeyInfo(dkToken);
            dkcbHandler.addDerivedKey(uuid, dkInfo);
          } else { ///i.e. dkToken has a STR
            SecurityTokenReference str2Base =
              dkToken.getSecuityTokenReference();
            if (str2Base.containsReference()) {
              Reference ref2Base = str2Base.getReference();
                          //TODO:: Find where can I find the constants.
              if (ref2Base
                .getValueType()
                .equals("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID")) {
                /* ok now I have a SAML token. What should I do ?
                 * -Decrypt the secret.
                 * -create tempUUID
                 * -add the scTInfo into dkcbHandler
                 * -add the derived key token to dkcbHandler.
                 */
                uuid = ref2Base.getURI();
                if(dkcbHandler.getSession(uuid)==null){
                  byte[] key = handleSAML(docSig, uuid);
                  System.out.println("I am here :-)");
                  SecurityContextInfo sctInfo =
                  new SecurityContextInfo(
                    uuid,
                    key,
                    1);
                  dkcbHandler.addSecurtiyContext(
                    uuid,
                  sctInfo);
                }
                  dkInfo = new DerivedKeyInfo(dkToken);
                  dkcbHandler.addDerivedKey(uuid, dkInfo);
                }
            } else if(str2Base.containsKeyIdentifier()){
                          Element elem = str2Base.getFirstElement();
                          //.getKeyIdentifier()System.out.println("KeyIdentifier :: He ehee ........");
                          String value = elem.getAttribute("ValueType");
                if("http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID".equals(value)){
                  uuid = ((Text)elem.getChildNodes().item(0)).getNodeValue();
                  if(dkcbHandler.getSession(uuid)==null){
                     byte[] key = handleSAML(elem.getOwnerDocument(), uuid);
                     System.out.println("UUID of SAML is"+uuid);
                     SecurityContextInfo sctInfo = new SecurityContextInfo(uuid,key,1);
                     dkcbHandler.addSecurtiyContext(uuid,sctInfo);
                  }
                dkInfo = new DerivedKeyInfo(dkToken);
                dkcbHandler.addDerivedKey(uuid, dkInfo);
                }

            } else {
              throw new ConversationException("Don't know how to process here");
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

                    securityHeader,
                    (new SecurityContextToken(doc, uuid)).getElement());
                ConversationManager manager = new ConversationManager();
                for (int i = 0; i < this.actionsInt.length; i++) {
                    // Derrive the token
                    DerivedKeyInfo dkInfo =
                        manager.createDerivedKeyToken(doc, uuid, dkcbHandler,null, keyLen);

                    String genID = dkInfo.getId();
                    SecurityTokenReference stRef =
                        dkInfo.getSecTokRef2DkToken();
                    if (actionsInt[i] == ConversationConstants.DK_ENCRYPT) {
                        manager.performDK_ENCR(
                            ConversationUtil.generateIdentifier(uuid, genID),
                            "",
                            true,
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

                    ref.setURI(oldRef.getURI());
                    ref.setValueType(oldRef.getValueType());
                    stRef2Base.setReference(ref);
                }
                DerivedKeyInfo dkInfo =
                        manager.createDerivedKeyToken(doc, uuid, dkcbHandler,stRef2Base, keyLen);

                String genID = dkInfo.getId();
                SecurityTokenReference stRef =
                        dkInfo.getSecTokRef2DkToken();

                if (actionsInt[i] == ConversationConstants.DK_ENCRYPT) {
                    manager.performDK_ENCR(
                            ConversationUtil.generateIdentifier(uuid, genID),
                            "",
View Full Code Here

Examples of org.apache.ws.sandbox.security.conversation.message.info.DerivedKeyInfo

                    securityHeader,
                    (new SecurityContextToken(doc, uuid)).getElement());
                ConversationManager manager = new ConversationManager();
                for (int i = 0; i < this.actionsInt.length; i++) {
                    // Derrive the token
                    DerivedKeyInfo dkInfo =
                        manager.createDerivedKeyToken(doc, uuid, dkcbHandler,null, keyLen);

                    String genID = dkInfo.getId();
                    SecurityTokenReference stRef =
                        dkInfo.getSecTokRef2DkToken();
                    if (actionsInt[i] == ConversationConstants.DK_ENCRYPT) {
                        manager.performDK_ENCR(
                            ConversationUtil.generateIdentifier(uuid, genID),
                            "",
                            true,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.