org.bouncycastle.openpgp
Class PGPUtil
java.lang.Object
org.bouncycastle.openpgp.PGPUtil
- HashAlgorithmTags
public class PGPUtil
extends java.lang.Object
Basic utility class
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, 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.
|
getDecoderStream
public static InputStream getDecoderStream(InputStream in)
throws IOException
Return either an ArmoredInputStream or a BCPGInputStream based on
whether the initial characters of the stream are binary PGP encodings or not.
in
- the stream to be wrapped
- a BCPGInputStream
getDefaultProvider
public static String getDefaultProvider()
Return the provider that will be used by factory classes in situations
where a provider must be determined on the fly.
- String
makeKeyFromPassPhrase
public static SecretKey makeKeyFromPassPhrase(int algorithm,
char[] passPhrase,
String provider)
throws NoSuchProviderException,
PGPException
makeKeyFromPassPhrase
public static SecretKey makeKeyFromPassPhrase(int algorithm,
S2K s2k,
char[] passPhrase,
String provider)
throws PGPException,
NoSuchProviderException
makeRandomKey
public static SecretKey makeRandomKey(int algorithm,
SecureRandom random)
throws PGPException
setDefaultProvider
public static void setDefaultProvider(String provider)
Set the provider to be used by the package when it is necessary to
find one on the fly.
provider
-
writeFileToLiteralData
public static void writeFileToLiteralData(OutputStream out,
char fileType,
File file)
throws IOException
write out the passed in file as a literal data packet.
out
- fileType
- the LiteralData type for the file.file
-
writeFileToLiteralData
public static void writeFileToLiteralData(OutputStream out,
char fileType,
File file,
byte[] buffer)
throws IOException
write out the passed in file as a literal data packet in partial packet format.
out
- fileType
- the LiteralData type for the file.file
- buffer
- buffer to be used to chunk the file into partial packets.