1 31 package org.objectweb.proactive.ext.security.crypto; 32 33 import java.io.Serializable ; 34 35 import java.security.Key ; 36 import java.security.Provider ; 37 import java.security.SecureRandom ; 38 39 import javax.crypto.KeyGenerator; 40 41 42 public class SessionKeyFactory implements Serializable { 43 private Provider myProvider; 44 45 private KeyGenerator keyGen; 47 48 public SessionKeyFactory() { 49 try { 53 keyGen = KeyGenerator.getInstance("Rijndael", "BC"); 55 keyGen.init(128, new SecureRandom ()); 56 57 } catch (Exception e) { 59 System.out.println("Exception in the Session Key Generation : " + 60 e); 61 } 62 } 63 64 public Key generateSessionKey() { 65 return keyGen.generateKey(); 66 } 67 } 68 | Popular Tags |