public class PGPUtil extends Object implements HashAlgorithmTags
DOUBLE_SHA, HAVAL_5_160, MD2, MD5, RIPEMD160, SHA1, SHA224, SHA256, SHA384, SHA512, TIGER_192| Constructor and Description |
|---|
PGPUtil() |
| Modifier and Type | Method and Description |
|---|---|
static InputStream |
getDecoderStream(InputStream in)
Return either an ArmoredInputStream or a BCPGInputStream based on
whether the initial characters of the stream are binary PGP encodings or not.
|
static String |
getDefaultProvider()
Return the provider that will be used by factory classes in situations
where a provider must be determined on the fly.
|
static SecretKey |
makeKeyFromPassPhrase(int algorithm,
char[] passPhrase,
String provider) |
static SecretKey |
makeKeyFromPassPhrase(int algorithm,
S2K s2k,
char[] passPhrase,
Provider provider) |
static SecretKey |
makeKeyFromPassPhrase(int algorithm,
S2K s2k,
char[] passPhrase,
String provider) |
static SecretKey |
makeRandomKey(int algorithm,
SecureRandom random) |
static void |
setDefaultProvider(String provider)
Set the provider to be used by the package when it is necessary to
find one on the fly.
|
static void |
writeFileToLiteralData(OutputStream out,
char fileType,
File file)
write out the passed in file as a literal data packet.
|
static void |
writeFileToLiteralData(OutputStream out,
char fileType,
File file,
byte[] buffer)
write out the passed in file as a literal data packet in partial packet format.
|
public static String getDefaultProvider()
public static void setDefaultProvider(String provider)
provider - public static SecretKey makeRandomKey(int algorithm, SecureRandom random) throws PGPException
PGPExceptionpublic static SecretKey makeKeyFromPassPhrase(int algorithm, char[] passPhrase, String provider) throws NoSuchProviderException, PGPException
NoSuchProviderExceptionPGPExceptionpublic static SecretKey makeKeyFromPassPhrase(int algorithm, S2K s2k, char[] passPhrase, String provider) throws PGPException, NoSuchProviderException
PGPExceptionNoSuchProviderExceptionpublic static SecretKey makeKeyFromPassPhrase(int algorithm, S2K s2k, char[] passPhrase, Provider provider) throws PGPException, NoSuchProviderException
PGPExceptionNoSuchProviderExceptionpublic static void writeFileToLiteralData(OutputStream out, char fileType, File file) throws IOException
out - fileType - the LiteralData type for the file.file - IOExceptionpublic static void writeFileToLiteralData(OutputStream out, char fileType, File file, byte[] buffer) throws IOException
out - fileType - the LiteralData type for the file.file - buffer - buffer to be used to chunk the file into partial packets.IOExceptionpublic static InputStream getDecoderStream(InputStream in) throws IOException
in - the stream to be wrappedIOException