1 11 package org.eclipse.core.internal.runtime.auth; 12 13 import java.io.*; 14 15 22 public class CipherOutputStream extends FilterOutputStream { 23 private Cipher cipher; 24 25 35 public CipherOutputStream(OutputStream os, String password) { 36 super(os); 37 cipher = new Cipher(Cipher.ENCRYPT_MODE, password); 38 } 39 40 43 public void write(int b) throws IOException { 44 try { 45 out.write(cipher.cipher((byte) b)); 46 } catch (Exception e) { 47 throw new IOException(e.getMessage()); 48 } 49 } 50 } 51 | Popular Tags |