Top Constructors Methods
org.bouncycastle.openpgp.examples

pack-priv Class PGPExampleUtil

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .ByteArrayOutputStream, .File, .FileInputStream, .IOException, .InputStream, java.security.NoSuchProviderException, java.util.Iterator, org.bouncycastle.openpgp.PGPCompressedDataGenerator, .PGPException, .PGPLiteralData, .PGPPrivateKey, .PGPPublicKey, .PGPPublicKeyRing, .PGPPublicKeyRingCollection, .PGPSecretKey, .PGPSecretKeyRing, .PGPSecretKeyRingCollection, .PGPUtil, org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator, .JcePBESecretKeyDecryptorBuilder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static byte[]
compressFile(String fileName, int algorithm)

pack-priv static PGPPrivateKey

Returns:

the private key.
findSecretKey
(PGPSecretKeyRingCollection
a secret key ring collection.
pgpSec
,
long
keyID we want.
keyID
,
char[]
passphrase to decrypt secret key with.
pass
)

Search a secret key ring collection for a secret key corresponding to keyID if it exists.

pack-priv static PGPPublicKey
pack-priv static PGPPublicKey

Returns:

the first public key found.
readPublicKey
(InputStream
data stream containing the public key data
input
)

A simple routine that opens a key ring file and loads the first available key suitable for encryption.

pack-priv static PGPSecretKey
pack-priv static PGPSecretKey

Returns:

a secret key.
readSecretKey
(InputStream
stream to read the secret key ring collection from.
input
)

A simple routine that opens a key ring file and loads the first available key suitable for signature generation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PGPExampleUtilback to summary
pack-priv PGPExampleUtil()

Method Detail

compressFileback to summary
pack-priv static byte[] compressFile(String fileName, int algorithm) throws IOException
findSecretKeyback to summary
pack-priv static PGPPrivateKey findSecretKey(PGPSecretKeyRingCollection pgpSec, long keyID, char[] pass) throws PGPException, NoSuchProviderException

Search a secret key ring collection for a secret key corresponding to keyID if it exists.

Parameters
pgpSec:PGPSecretKeyRingCollection

a secret key ring collection.

keyID:long

keyID we want.

pass:char[]

passphrase to decrypt secret key with.

Returns:PGPPrivateKey

the private key.

readPublicKeyback to summary
pack-priv static PGPPublicKey readPublicKey(String fileName) throws IOException, PGPException
readPublicKeyback to summary
pack-priv static PGPPublicKey readPublicKey(InputStream input) throws IOException, PGPException

A simple routine that opens a key ring file and loads the first available key suitable for encryption.

Parameters
input:InputStream

data stream containing the public key data

Returns:PGPPublicKey

the first public key found.

readSecretKeyback to summary
pack-priv static PGPSecretKey readSecretKey(String fileName) throws IOException, PGPException
readSecretKeyback to summary
pack-priv static PGPSecretKey readSecretKey(InputStream input) throws IOException, PGPException

A simple routine that opens a key ring file and loads the first available key suitable for signature generation.

Parameters
input:InputStream

stream to read the secret key ring collection from.

Returns:PGPSecretKey

a secret key.

Exceptions
IOException:
on a problem with using the input stream.
PGPException:
if there is an issue parsing the input stream.