To encrypt a file: KeyBasedFileProcessor -e [-a|-ai] fileName publicKeyFile.
If -a is specified the output file will be "ascii-armored".
If -i is specified the output file will be have integrity checking added.
To decrypt: KeyBasedFileProcessor -d fileName secretKeyFile passPhrase.
Note 1: this example will silently overwrite files, nor does it pay any attention to the specification of "_CONSOLE" in the filename. It also expects that a single pass phrase will have been used.
Note 2: if an empty file name has been specified in the literal data object contained in the encrypted packet a file with the name filename.out will be generated in the current working directory.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private static void | decryptFile(InputStream in, InputStream keyIn, char[] passwd, String defaultFileName)
decrypt the passed in message stream |
| private static void | encryptFile(String outputFileName, String inputFileName, String encKeyFileName, boolean armor, boolean withIntegrityCheck)
|
| private static void | encryptFile(OutputStream out, String fileName, PGPPublicKey encKey, boolean armor, boolean withIntegrityCheck)
|
| public static void |
| KeyBasedFileProcessor | back to summary |
|---|---|
| public KeyBasedFileProcessor() | |
| decryptFile | back to summary |
|---|---|
| private static void decryptFile(String inputFileName, String keyFileName, char[] passwd, String defaultFileName) throws IOException, NoSuchProviderException | |
| decryptFile | back to summary |
|---|---|
| private static void decryptFile(InputStream in, InputStream keyIn, char[] passwd, String defaultFileName) throws IOException, NoSuchProviderException decrypt the passed in message stream | |
| encryptFile | back to summary |
|---|---|
| private static void encryptFile(String outputFileName, String inputFileName, String encKeyFileName, boolean armor, boolean withIntegrityCheck) throws IOException, NoSuchProviderException, PGPException | |
| encryptFile | back to summary |
|---|---|
| private static void encryptFile(OutputStream out, String fileName, PGPPublicKey encKey, boolean armor, boolean withIntegrityCheck) throws IOException, NoSuchProviderException | |
| main | back to summary |
|---|---|
| public static void main(String[] args) throws Exception | |