Package javax.crypto.spec

Examples of javax.crypto.spec.DESedeKeySpec


    {
      byte[] keyAsBytes = encryptionKey.getBytes( UNICODE_FORMAT );
     
      if ( encryptionScheme.equals( DESEDE_ENCRYPTION_SCHEME) )
      {
        keySpec = new DESedeKeySpec( keyAsBytes );
      }
      else if ( encryptionScheme.equals( DES_ENCRYPTION_SCHEME ) )
      {
        keySpec = new DESKeySpec( keyAsBytes );
      }
View Full Code Here


        this.encryptedKey = encryptedKey;
        /* get SecretKey from encryptedKey */
        byte[] key = getDecrypted(encryptedKey, password);
        try {
            SecretKeyFactory keyFac = SecretKeyFactory.getInstance(CRYPTO_ALGORITHM);
            this.secretKey = keyFac.generateSecret(new DESedeKeySpec(key));;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

                }

                keyblob = bar.readBinaryString();

                Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");
                KeySpec keyspec = new DESedeKeySpec(keydata);
                Key key = SecretKeyFactory.getInstance("DESede").generateSecret(keyspec);
                cipher.init(Cipher.DECRYPT_MODE, key,
                    new IvParameterSpec(iv, 0, cipher.getBlockSize()));

                ByteArrayReader data = new ByteArrayReader(cipher.doFinal(
View Full Code Here

                    byte[] iv = new byte[8];
                    Utils.getRND().nextBytes(iv);

                    Cipher cipher = Cipher.getInstance(
                            "DESede/CBC/PKCS5Padding");
                    KeySpec keyspec = new DESedeKeySpec(keydata);
                    Key key = SecretKeyFactory.getInstance("DESede")
                                              .generateSecret(keyspec);
                    cipher.init(Cipher.ENCRYPT_MODE, key,
                        new IvParameterSpec(iv, 0, cipher.getBlockSize()));
View Full Code Here

          desedekey[i] = key[i];
        } else {
          desedekey[i] = 0;
        }
      }
      key = (new DESedeKeySpec(desedekey)).getKey();
    }

    SecretKey secretKey = new SecretKeySpec(key,algorithm);

    /* DES in ECB mode does not require any parameters */
 
View Full Code Here

        actions.add(XMLSecurityConstants.ENCRYPT);
        properties.setActions(actions);
       
        // Set the key up
        byte[] passPhrase = "24 Bytes per DESede key!".getBytes();
        DESedeKeySpec keySpec = new DESedeKeySpec(passPhrase);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
        SecretKey key = keyFactory.generateSecret(keySpec);
        properties.setEncryptionKey(key);
        properties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
       
View Full Code Here

        actions.add(XMLSecurityConstants.ENCRYPT);
        properties.setActions(actions);
       
        // Set the key up
        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
        DESedeKeySpec keySpec = new DESedeKeySpec(bits192);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
        SecretKey key = keyFactory.generateSecret(keySpec);
        properties.setEncryptionKey(key);
        properties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
       
View Full Code Here

        actions.add(XMLSecurityConstants.ENCRYPT);
        properties.setActions(actions);
       
        // Set the key up
        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
        DESedeKeySpec keySpec = new DESedeKeySpec(bits192);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
        SecretKey key = keyFactory.generateSecret(keySpec);
        properties.setEncryptionKey(key);
        properties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
       
View Full Code Here

    /**
     * Generate a secret key
     */
    private SecretKey generateDESSecretKey() throws Exception {
        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
        DESedeKeySpec keySpec = new DESedeKeySpec(bits192);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
        return keyFactory.generateSecret(keySpec);
    }
View Full Code Here

    /**
     * Generate a secret key
     */
    private SecretKey generateDESSecretKey() throws Exception {
        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
        DESedeKeySpec keySpec = new DESedeKeySpec(bits192);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
        return keyFactory.generateSecret(keySpec);
    }
View Full Code Here

TOP

Related Classes of javax.crypto.spec.DESedeKeySpec

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.