Package javax.crypto

Examples of javax.crypto.KeyGenerator.generateKey()


    // Generate Encryption Key
    String jceAlgorithmName = "AES";
    KeyGenerator keyGenerator =
        KeyGenerator.getInstance(jceAlgorithmName);
    keyGenerator.init(128);
    SecretKey key = keyGenerator.generateKey();

    // Create the entry to encrypt
    Abdera abdera = new Abdera();
    AbderaSecurity absec = new AbderaSecurity(abdera);
    Factory factory = abdera.getFactory();
View Full Code Here


        }
        Cipher enccipher = null;
        try {
            KeyGenerator keygen = KeyGenerator.getInstance(a);
            keygen.init(new SecureRandom());
            key = keygen.generateKey();
            enccipher = Cipher.getInstance(transformation);
            enccipher.init(Cipher.ENCRYPT_MODE, key);
            ivp = enccipher.getIV();
        } catch (GeneralSecurityException e) {
            enccipher = null;
View Full Code Here

   
    private byte[] getSymmetricKey(String symEncAlgo) throws Exception {
        synchronized (this) {
            if (symmetricKey == null) {
                KeyGenerator keyGen = getKeyGenerator(symEncAlgo);
                symmetricKey = keyGen.generateKey();
            }
            return symmetricKey.getEncoded();
        }
    }
   
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(128);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(128);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2009/xmlenc11#aes128-gcm";
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(192);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(192);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2009/xmlenc11#aes192-gcm";
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(256);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(256);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2009/xmlenc11#aes256-gcm";
View Full Code Here

        Document document = builder.parse(sourceDocument);
       
        // Set up the Key
        KeyGenerator keygen = KeyGenerator.getInstance("DESede");
        keygen.init(192);
        SecretKey key = keygen.generateKey();
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
        String algorithm = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
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.