1 20 21 package net.sourceforge.lightcrypto; 22 23 import org.bouncycastle.util.encoders.Base64; 24 25 34 35 public class SafeObject { 36 private byte[] safetext; 37 38 44 public void setText (byte[] s) 45 throws Exception { 46 this.safetext = s; 47 } 48 49 55 public StringBuffer getText () 56 throws Exception { 57 return new StringBuffer (new String (safetext)); 58 } 59 60 66 public String getBase64 () 67 throws Exception { 68 return new String (Base64.encode(this.safetext)); 69 } 70 71 77 public int getLength () 78 throws Exception { 79 return safetext.length; 80 } 81 82 88 public byte[] getBytes () 89 throws Exception { 90 return safetext; 91 } 92 93 98 public void clearText () 99 throws Exception { 100 for (int i = 0; i < safetext.length; i++) 101 { 102 safetext[i] = 0; 103 } 104 } 105 } 106 | Popular Tags |