Examples of deriveKey()


Examples of ca.carleton.gcrc.security.kdf.KDFCounterMode.deriveKey()

    }
  }
 
  static private SecretKeySpec deriveKey(byte[] productionKey, byte[] context) throws Exception {
    KDFCounterMode kdf = new KDFCounterModeImpl();
    byte[] raw = kdf.deriveKey(productionKey, LABEL, context, 16);
    SecretKeySpec encryptionKey = new SecretKeySpec(raw, "AES");
    return encryptionKey;
  }

}
View Full Code Here

Examples of ca.carleton.gcrc.security.kdf.impl.KDFCounterModeImpl.deriveKey()

    }
  }
 
  static private SecretKeySpec deriveKey(byte[] productionKey, byte[] context) throws Exception {
    KDFCounterMode kdf = new KDFCounterModeImpl();
    byte[] raw = kdf.deriveKey(productionKey, LABEL, context, 16);
    SecretKeySpec encryptionKey = new SecretKeySpec(raw, "AES");
    return encryptionKey;
  }

}
View Full Code Here

Examples of de.rtner.security.auth.spi.PBKDF2Engine.deriveKey()

    st.nextToken();
    String iterationCount = st.nextToken(",");

    // SaltedPassword  := Hi(Normalize(password), salt, i)
    PBKDF2Engine engine = new PBKDF2Engine(new PBKDF2Parameters("HMacSHA1", null, serverSalt, Integer.parseInt(iterationCount)));
    byte[] saltedPassword = engine.deriveKey(password, 20);

      // ClientKey       := HMAC(SaltedPassword, "Client Key")
    hmac.init(saltedPassword);
    byte[] clientKey = hmac.doFinal("Client Key".getBytes());
View Full Code Here

Examples of org.apache.ws.security.message.token.DerivedKeyToken.deriveKey()

            DerivedKeyToken dkt =
                (DerivedKeyToken)result.get(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN);
            byte[] secret =
                (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
            String algorithm = (String)parameters.get(SIGNATURE_METHOD);
            secretKey = dkt.deriveKey(WSSecurityUtil.getKeyLength(algorithm), secret);
        } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
            AssertionWrapper assertion =
                (AssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
            secretKey =
                getSecretKeyFromAssertion(assertion, secRef, data, wsDocInfo, bspCompliant);
View Full Code Here

Examples of org.apache.ws.security.message.token.DerivedKeyToken.deriveKey()

        String tempNonce = dkt.getNonce();
        if (tempNonce == null) {
            throw new WSSecurityException("Missing wsc:Nonce value");
        }
        int length = dkt.getLength();
        byte[] keyBytes = dkt.deriveKey(length, secret);
        WSSecurityEngineResult result =
            new WSSecurityEngineResult(WSConstants.DKT, null, keyBytes, null);
        wsDocInfo.addTokenElement(elem);
        result.put(WSSecurityEngineResult.TAG_ID, dkt.getID());
        result.put(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN, dkt);
View Full Code Here

Examples of org.apache.ws.security.message.token.DerivedKeyToken.deriveKey()

            DerivedKeyToken dkt =
                (DerivedKeyToken)result.get(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN);
            byte[] secret =
                (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
            String algorithm = (String)parameters.get(SIGNATURE_METHOD);
            secretKey = dkt.deriveKey(WSSecurityUtil.getKeyLength(algorithm), secret);
            principal = dkt.createPrincipal();
        } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
            AssertionWrapper assertion =
                (AssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
            secretKey =
View Full Code Here

Examples of org.apache.ws.security.message.token.DerivedKeyToken.deriveKey()

            if (keyLength <= 0) {
                String algorithm = (String)parameters.get(SIGNATURE_METHOD);
                keyLength = WSSecurityUtil.getKeyLength(algorithm);
            }
            byte[] secret = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
            secretKey = dkt.deriveKey(keyLength, secret);
            principal = dkt.createPrincipal();
            ((WSDerivedKeyTokenPrincipal)principal).setSecret(secret);
        } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
            AssertionWrapper assertion =
                (AssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
View Full Code Here

Examples of org.apache.ws.security.message.token.DerivedKeyToken.deriveKey()

            if (keyLength <= 0) {
                String algorithm = (String)parameters.get(SIGNATURE_METHOD);
                keyLength = WSSecurityUtil.getKeyLength(algorithm);
            }
            byte[] secret = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
            secretKey = dkt.deriveKey(keyLength, secret);
            principal = dkt.createPrincipal();
            ((WSDerivedKeyTokenPrincipal)principal).setSecret(secret);
        } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
            AssertionWrapper assertion =
                (AssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
View Full Code Here

Examples of org.apache.wss4j.dom.message.token.DerivedKeyToken.deriveKey()

            if (keyLength <= 0) {
                String algorithm = (String)parameters.get(SIGNATURE_METHOD);
                keyLength = KeyUtils.getKeyLength(algorithm);
            }
            byte[] secret = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
            secretKey = dkt.deriveKey(keyLength, secret);
            principal = dkt.createPrincipal();
            ((WSDerivedKeyTokenPrincipal)principal).setSecret(secret);
        } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
            SamlAssertionWrapper samlAssertion =
                (SamlAssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
View Full Code Here

Examples of org.apache.wss4j.dom.message.token.DerivedKeyToken.deriveKey()

            DerivedKeyToken dkt =
                (DerivedKeyToken)result.get(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN);
            byte[] secret =
                (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
            String algorithm = (String)parameters.get(SIGNATURE_METHOD);
            secretKey = dkt.deriveKey(KeyUtils.getKeyLength(algorithm), secret);
            principal = dkt.createPrincipal();
        } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
            SamlAssertionWrapper samlAssertion =
                (SamlAssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
            secretKey = getSecretKeyFromAssertion(samlAssertion, secRef, data, wsDocInfo);
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.