Top Description Constructors Methods
org.bouncycastle.openpgp.examples

public Class SignedFileProcessor

extends Object
Class Inheritance
Imports
java.io.File, .FileInputStream, .FileOutputStream, .IOException, .InputStream, .OutputStream, java.security.NoSuchAlgorithmException, .NoSuchProviderException, .Security, .SignatureException, java.util.Iterator, org.bouncycastle.bcpg.ArmoredOutputStream, .BCPGOutputStream, org.bouncycastle.jce.provider.BouncyCastleProvider, org.bouncycastle.openpgp.PGPCompressedData, .PGPCompressedDataGenerator, .PGPException, .PGPLiteralData, .PGPLiteralDataGenerator, .PGPOnePassSignature, .PGPOnePassSignatureList, .PGPPrivateKey, .PGPPublicKey, .PGPPublicKeyRingCollection, .PGPSecretKey, .PGPSignature, .PGPSignatureGenerator, .PGPSignatureList, .PGPSignatureSubpacketGenerator, .PGPUtil, org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory, org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator, .JcaPGPContentSignerBuilder, .JcaPGPContentVerifierBuilderProvider, .JcePBESecretKeyDecryptorBuilder

A simple utility class that signs and verifies files.

To sign a file: SignedFileProcessor -s [-a] fileName secretKey passPhrase.
If -a is specified the output file will be "ascii-armored".

To decrypt: SignedFileProcessor -v fileName publicKeyFile.

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.

Note

the example also makes use of PGP compression. If you are having difficulty getting it to interoperate with other PGP programs try removing the use of compression first.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
main(String[] args)

private static void
signFile(String fileName, InputStream keyIn, OutputStream out, char[] pass, boolean armor)

Generate an encapsulated signed file.

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SignedFileProcessorback to summary
public SignedFileProcessor()

Method Detail

mainback to summary
public static void main(String[] args) throws Exception
signFileback to summary
private static void signFile(String fileName, InputStream keyIn, OutputStream out, char[] pass, boolean armor) throws IOException, PGPException

Generate an encapsulated signed file.

verifyFileback to summary
private static void verifyFile(InputStream in, InputStream keyIn) throws Exception