Top Description Constructors Methods
org.bouncycastle.openpgp.examples

public Class PBEFileProcessor

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .BufferedOutputStream, .File, .FileInputStream, .FileOutputStream, .IOException, .InputStream, .OutputStream, java.security.SecureRandom, .Security, org.bouncycastle.bcpg.ArmoredOutputStream, .CompressionAlgorithmTags, .SymmetricKeyAlgorithmTags, org.bouncycastle.jce.provider.BouncyCastleProvider, org.bouncycastle.openpgp.PGPCompressedData, .PGPCompressedDataGenerator, .PGPEncryptedDataGenerator, .PGPEncryptedDataList, .PGPException, .PGPLiteralData, .PGPPBEEncryptedData, .PGPUtil, org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory, org.bouncycastle.openpgp.operator.PGPDataEncryptorBuilder, org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder, .JcePBEDataDecryptorFactoryBuilder, .JcePBEKeyEncryptionMethodGenerator, .JcePGPDataEncryptorBuilder, org.bouncycastle.util.io.Streams

A simple utility class that encrypts/decrypts password based encryption files.

To encrypt a file: PBEFileProcessor -e [-a] fileName passPhrase.
If -a is specified the output file will be "ascii-armored".

To decrypt: PBEFileProcessor -d fileName passPhrase.

Note

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.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
decryptFile(String inputFileName, char[] passPhrase)

private static void
decryptFile(InputStream in, char[] passPhrase)

private static void
encryptFile(String outputFileName, String inputFileName, char[] passPhrase, boolean armor)

private static void
encryptToStream(OutputStream out, String fileName, char[] passPhrase, boolean armor)

public static void
main(String[] args)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PBEFileProcessorback to summary
public PBEFileProcessor()

Method Detail

decryptFileback to summary
private static void decryptFile(String inputFileName, char[] passPhrase) throws IOException, PGPException
decryptFileback to summary
private static void decryptFile(InputStream in, char[] passPhrase) throws IOException, PGPException
encryptFileback to summary
private static void encryptFile(String outputFileName, String inputFileName, char[] passPhrase, boolean armor) throws IOException
encryptToStreamback to summary
private static void encryptToStream(OutputStream out, String fileName, char[] passPhrase, boolean armor) throws IOException
mainback to summary
public static void main(String[] args) throws Exception