OutputStream out = new ObjectOutputStream(new FileOutputStream("encrypter.key"));
// Serialize the secret to a byte array
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput objectOutput = new ObjectOutputStream(bos);
objectOutput.writeObject(secret);
objectOutput.writeObject(secret);
objectOutput.close();
// Get the bytes of the serialized object and use them as the inputstream
InputStream is = new ByteArrayInputStream(bos.toByteArray());
streamEncrypter.encrypt(is, out);
streamEncrypter.encrypt(is, out);
No comments:
Post a Comment