| java.lang.Object org.bouncycastle.openpgp.examples.ByteArrayHandler
ByteArrayHandler | public class ByteArrayHandler (Code) | | Simple routine to encrypt and decrypt using a passphrase.
This service routine provides the basic PGP services between
byte arrays.
Note: this code plays no attention to -CONSOLE in the file name
the specification of "_CONSOLE" in the filename.
It also expects that a single pass phrase will have been used.
|
Method Summary | |
public static byte[] | decrypt(byte[] encrypted, char[] passPhrase) decrypt the passed in message stream
Parameters: encrypted - The message to be decrypted. Parameters: passPhrase - Pass phrase (key) Clear text as a byte array. | public static byte[] | encrypt(byte[] clearData, char[] passPhrase, String fileName, int algorithm, boolean armor) Simple PGP encryptor between byte[].
Parameters: clearData - The test to be encrypted Parameters: passPhrase - The pass phrase (key). | public static void | main(String[] args) |
encrypt | public static byte[] encrypt(byte[] clearData, char[] passPhrase, String fileName, int algorithm, boolean armor) throws IOException, PGPException, NoSuchProviderException(Code) | | Simple PGP encryptor between byte[].
Parameters: clearData - The test to be encrypted Parameters: passPhrase - The pass phrase (key). This method assumes that thekey is a simple pass phrase, and does not yet supportRSA or more sophisiticated keying. Parameters: fileName - File name. This is used in the Literal Data Packet (tag 11)which is really inly important if the data is to berelated to a file to be recovered later. Because thisroutine does not know the source of the information, thecaller can set something here for file name use thatwill be carried. If this routine is being used toencrypt SOAP MIME bodies, for example, use the file name from theMIME type, if applicable. Or anything else appropriate. Parameters: armor - encrypted data. exception: IOException - exception: PGPException - exception: NoSuchProviderException - |
|
|