1 49 package com.lowagie.text.pdf.crypto; 50 51 55 public class IVGenerator { 56 57 private static ARCFOUREncryption arcfour; 58 59 static { 60 arcfour = new ARCFOUREncryption(); 61 long time = System.currentTimeMillis(); 62 long mem = Runtime.getRuntime().freeMemory(); 63 String s = time + "+" + mem; 64 arcfour.prepareARCFOURKey(s.getBytes()); 65 } 66 67 68 private IVGenerator() { 69 } 70 71 75 public static byte[] getIV() { 76 return getIV(16); 77 } 78 79 84 public static byte[] getIV(int len) { 85 byte[] b = new byte[len]; 86 synchronized (arcfour) { 87 arcfour.encryptARCFOUR(b); 88 } 89 return b; 90 } 91 } | Popular Tags |