Package javax.crypto

Examples of javax.crypto.SecretKey


       
        // Set up the Key
        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
        DESedeKeySpec keySpec = new DESedeKeySpec(bits192);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
        SecretKey secretKey = keyFactory.generateSecret(keySpec);

        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("elem");
        encryptUsingDOM(
View Full Code Here


            Element creditCardElement = (Element)nodeList.item(nodeList.getLength() - 1);
            creditCardElement.appendChild(document.getDocumentElement().cloneNode(true));
        }

        // Set up the Key
        SecretKey secretKey = generateSecretKey();

        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        encryptUsingDOM(
View Full Code Here

        PublicKey pub = kp.getPublic();

        // Generate a traffic key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(256);
        SecretKey secretKey = keygen.generateKey();

        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        encryptUsingDOM(
View Full Code Here

        properties.setActions(actions);
       
        // Set the key up
        byte[] hmacKey = "secret".getBytes("ASCII");
        String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
        SecretKey key = new SecretKeySpec(hmacKey, signatureAlgorithm);
        properties.setSignatureKey(key);
       
        properties.setSignatureAlgorithm(signatureAlgorithm);
       
        SecurePart securePart = new SecurePart(
View Full Code Here

        properties.setActions(actions);
       
        // Set the key up
        byte[] hmacKey = "secret".getBytes("ASCII");
        String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
        SecretKey key = new SecretKeySpec(hmacKey, signatureAlgorithm);
        properties.setSignatureKey(key);
       
        properties.setSignatureAlgorithm(signatureAlgorithm);
       
        SecurePart securePart = new SecurePart(
View Full Code Here

        properties.setActions(actions);
       
        // Set the key up
        byte[] hmacKey = "secret".getBytes("ASCII");
        String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";
        SecretKey key = new SecretKeySpec(hmacKey, signatureAlgorithm);
        properties.setSignatureKey(key);
       
        properties.setSignatureAlgorithm(signatureAlgorithm);
       
        SecurePart securePart = new SecurePart(
View Full Code Here

        properties.setActions(actions);
       
        // Set the key up
        byte[] hmacKey = "secret".getBytes("ASCII");
        String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160";
        SecretKey key = new SecretKeySpec(hmacKey, signatureAlgorithm);
        properties.setSignatureKey(key);
       
        properties.setSignatureAlgorithm(signatureAlgorithm);
       
        SecurePart securePart = new SecurePart(
View Full Code Here

        DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        byte[] hmacKey = "secret".getBytes("ASCII");
        SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2000/09/xmldsig#hmac-sha1");
       
        // XMLUtils.outputDOM(document, System.out);
       
        // Convert Document to a Stream Reader
        javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
View Full Code Here

        DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        byte[] hmacKey = "secret".getBytes("ASCII");
        SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2000/09/xmldsig#hmac-sha1");
       
        // XMLUtils.outputDOM(document, System.out);
       
        // Convert Document to a Stream Reader
        javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
View Full Code Here

    public SymmetricCipher(CipherInformation cipherInformation, Key key) {
        super(cipherInformation, key);
    }

    public Key getKey(CipherOperationMode operationMode) {
        SecretKey secretKey = keyStoreWrapper.getSecretKey();
        if (secretKey == null) {
            if (defaultKeySpec == null) {
                defaultKeySpec = createDefaultKey();
            }
            return defaultKeySpec;
View Full Code Here

TOP

Related Classes of javax.crypto.SecretKey

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.