|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.openpgp.PGPUtil
PGP utilities.
Fields inherited from interface org.bouncycastle.bcpg.HashAlgorithmTags |
DOUBLE_SHA, HAVAL_5_160, MD2, MD4, MD5, RIPEMD160, SHA1, SHA224, SHA256, SHA3_224, SHA3_256, SHA3_256_OLD, SHA3_384, SHA3_512, SHA3_512_OLD, SHA384, SHA512, SM3, TIGER_192 |
Constructor Summary | |
PGPUtil()
|
Method Summary | |
static java.lang.String |
getCurveName(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
Return the EC curve name for the passed in OID. |
static java.io.InputStream |
getDecoderStream(java.io.InputStream in)
Obtains a stream that can be used to read PGP data from the provided stream. |
static java.lang.String |
getDefaultProvider()
Deprecated. unused |
static int |
getDigestIDForName(java.lang.String name)
|
static java.lang.String |
getDigestName(int hashAlgorithm)
Return an appropriate name for the hash algorithm represented by the passed in hash algorithm ID number. |
static java.lang.String |
getSignatureName(int keyAlgorithm,
int hashAlgorithm)
Return an appropriate name for the signature algorithm represented by the passed in public key and hash algorithm ID numbers. |
static java.lang.String |
getSymmetricCipherName(int algorithm)
Return an appropriate name for the symmetric algorithm represented by the passed in symmetric algorithm ID number. |
static boolean |
isKeyBox(byte[] data)
Return true if the byte[] blob probably represents key box data. |
static boolean |
isKeyRing(byte[] blob)
Return true if the byte[] blob probably represents key ring data. |
static byte[] |
makeRandomKey(int algorithm,
java.security.SecureRandom random)
Generates a random key for a symmetric encryption algorithm
. |
static void |
setDefaultProvider(java.lang.String provider)
Deprecated. unused |
static void |
writeFileToLiteralData(java.io.OutputStream out,
char fileType,
java.io.File file)
Write out the contents of the provided file as a literal data packet. |
static void |
writeFileToLiteralData(java.io.OutputStream out,
char fileType,
java.io.File file,
byte[] buffer)
Write out the contents of the provided file as a literal data packet in partial packet format. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PGPUtil()
Method Detail |
public static java.lang.String getDigestName(int hashAlgorithm) throws PGPException
hashAlgorithm
- the algorithm ID for a hash algorithm.public static int getDigestIDForName(java.lang.String name)
public static java.lang.String getCurveName(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
oid
- the EC curve object identifier in the PGP keypublic static java.lang.String getSignatureName(int keyAlgorithm, int hashAlgorithm) throws PGPException
keyAlgorithm
- the algorithm ID for the public key algorithm used in the signature.hashAlgorithm
- the algorithm ID for the hash algorithm used.public static java.lang.String getSymmetricCipherName(int algorithm)
algorithm
- the algorithm ID for a symmetric cipher.public static java.lang.String getDefaultProvider()
public static void setDefaultProvider(java.lang.String provider)
provider
- the name of the JCA/JCE provider to use by default.public static boolean isKeyRing(byte[] blob) throws java.io.IOException
public static boolean isKeyBox(byte[] data) throws java.io.IOException
public static byte[] makeRandomKey(int algorithm, java.security.SecureRandom random) throws PGPException
symmetric encryption algorithm
.algorithm
- the symmetric key algorithm identifier.random
- a source of random data.PGPException
- if the encryption algorithm is unknown.public static void writeFileToLiteralData(java.io.OutputStream out, char fileType, java.io.File file) throws java.io.IOException
out
- the stream to write the literal data to.fileType
- the PGPLiteralData
type to use for the file data.file
- the file to write the contents of.java.io.IOException
- if an error occurs reading the file or writing to the output stream.public static void writeFileToLiteralData(java.io.OutputStream out, char fileType, java.io.File file, byte[] buffer) throws java.io.IOException
out
- the stream to write the literal data to.fileType
- the PGPLiteralData
type to use for the file data.file
- the file to write the contents of.buffer
- buffer to be used to chunk the file into partial packets.java.io.IOException
- if an error occurs reading the file or writing to the output stream.PGPLiteralDataGenerator.open(OutputStream, char, String, Date, byte[])
public static java.io.InputStream getDecoderStream(java.io.InputStream in) throws java.io.IOException
If the initial bytes of the underlying stream are binary PGP encodings, then the stream will
be returned directly, otherwise an ArmoredInputStream
is used to wrap the provided
stream and remove ASCII-Armored encoding.
in
- the stream to be checked and possibly wrapped.java.io.IOException
- if an error occurs reading the stream, or initialising the
ArmoredInputStream
.
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |