Package org.pgpainless.key.parsing
Class KeyRingReader
- java.lang.Object
-
- org.pgpainless.key.parsing.KeyRingReader
-
public class KeyRingReader extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_ITERATIONSstatic java.nio.charset.CharsetUTF8
-
Constructor Summary
Constructors Constructor Description KeyRingReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.openpgp.PGPKeyRingkeyRing(byte[] bytes)Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given byte array.org.bouncycastle.openpgp.PGPKeyRingkeyRing(java.io.InputStream inputStream)Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the givenInputStream.org.bouncycastle.openpgp.PGPKeyRingkeyRing(java.lang.String asciiArmored)Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given ASCII armored string.PGPKeyRingCollectionkeyRingCollection(byte[] bytes, boolean isSilent)PGPKeyRingCollectionkeyRingCollection(java.io.InputStream inputStream, boolean isSilent)PGPKeyRingCollectionkeyRingCollection(java.lang.String asciiArmored, boolean isSilent)org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRing(byte[] bytes)org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRing(java.io.InputStream inputStream)org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRing(java.lang.String asciiArmored)org.bouncycastle.openpgp.PGPPublicKeyRingCollectionpublicKeyRingCollection(byte[] bytes)org.bouncycastle.openpgp.PGPPublicKeyRingCollectionpublicKeyRingCollection(java.io.InputStream inputStream)org.bouncycastle.openpgp.PGPPublicKeyRingCollectionpublicKeyRingCollection(java.lang.String asciiArmored)static org.bouncycastle.openpgp.PGPKeyRingreadKeyRing(java.io.InputStream inputStream)Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the givenInputStream.static org.bouncycastle.openpgp.PGPKeyRingreadKeyRing(java.io.InputStream inputStream, int maxIterations)Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the givenInputStream.static PGPKeyRingCollectionreadKeyRingCollection(java.io.InputStream inputStream, boolean isSilent)static org.bouncycastle.openpgp.PGPPublicKeyRingreadPublicKeyRing(java.io.InputStream inputStream)static org.bouncycastle.openpgp.PGPPublicKeyRingreadPublicKeyRing(java.io.InputStream inputStream, int maxIterations)Read a public key ring from the providedInputStream.static org.bouncycastle.openpgp.PGPPublicKeyRingCollectionreadPublicKeyRingCollection(java.io.InputStream inputStream)static org.bouncycastle.openpgp.PGPPublicKeyRingCollectionreadPublicKeyRingCollection(java.io.InputStream inputStream, int maxIterations)Read a public key ring collection from the providedInputStream.static org.bouncycastle.openpgp.PGPSecretKeyRingreadSecretKeyRing(java.io.InputStream inputStream)static org.bouncycastle.openpgp.PGPSecretKeyRingreadSecretKeyRing(java.io.InputStream inputStream, int maxIterations)Read a secret key ring from the providedInputStream.static org.bouncycastle.openpgp.PGPSecretKeyRingCollectionreadSecretKeyRingCollection(java.io.InputStream inputStream)static org.bouncycastle.openpgp.PGPSecretKeyRingCollectionreadSecretKeyRingCollection(java.io.InputStream inputStream, int maxIterations)Read a secret key ring collection from the providedInputStream.org.bouncycastle.openpgp.PGPSecretKeyRingsecretKeyRing(byte[] bytes)org.bouncycastle.openpgp.PGPSecretKeyRingsecretKeyRing(java.io.InputStream inputStream)org.bouncycastle.openpgp.PGPSecretKeyRingsecretKeyRing(java.lang.String asciiArmored)org.bouncycastle.openpgp.PGPSecretKeyRingCollectionsecretKeyRingCollection(byte[] bytes)org.bouncycastle.openpgp.PGPSecretKeyRingCollectionsecretKeyRingCollection(java.io.InputStream inputStream)org.bouncycastle.openpgp.PGPSecretKeyRingCollectionsecretKeyRingCollection(java.lang.String asciiArmored)
-
-
-
Field Detail
-
MAX_ITERATIONS
public static final int MAX_ITERATIONS
- See Also:
- Constant Field Values
-
UTF8
public static final java.nio.charset.Charset UTF8
-
-
Method Detail
-
keyRing
public org.bouncycastle.openpgp.PGPKeyRing keyRing(@Nonnull java.io.InputStream inputStream) throws java.io.IOExceptionRead aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the givenInputStream.- Parameters:
inputStream- inputStream containing the OpenPGP key or certificate- Returns:
- key ring
- Throws:
java.io.IOException- in case of an IO error
-
keyRing
public org.bouncycastle.openpgp.PGPKeyRing keyRing(@Nonnull byte[] bytes) throws java.io.IOExceptionRead aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given byte array.- Parameters:
bytes- byte array containing the OpenPGP key or certificate- Returns:
- key ring
- Throws:
java.io.IOException- in case of an IO error
-
keyRing
public org.bouncycastle.openpgp.PGPKeyRing keyRing(@Nonnull java.lang.String asciiArmored) throws java.io.IOExceptionRead aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given ASCII armored string.- Parameters:
asciiArmored- ASCII armored OpenPGP key or certificate- Returns:
- key ring
- Throws:
java.io.IOException- in case of an IO error
-
publicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRing(@Nonnull java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
publicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRing(@Nonnull byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
publicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRing(@Nonnull java.lang.String asciiArmored) throws java.io.IOException- Throws:
java.io.IOException
-
publicKeyRingCollection
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeyRingCollection(@Nonnull java.io.InputStream inputStream) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
publicKeyRingCollection
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeyRingCollection(@Nonnull byte[] bytes) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
publicKeyRingCollection
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeyRingCollection(@Nonnull java.lang.String asciiArmored) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
secretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing(@Nonnull java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
secretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing(@Nonnull byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
secretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing(@Nonnull java.lang.String asciiArmored) throws java.io.IOException- Throws:
java.io.IOException
-
secretKeyRingCollection
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeyRingCollection(@Nonnull java.io.InputStream inputStream) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
secretKeyRingCollection
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeyRingCollection(@Nonnull byte[] bytes) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
secretKeyRingCollection
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeyRingCollection(@Nonnull java.lang.String asciiArmored) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingCollection
public PGPKeyRingCollection keyRingCollection(@Nonnull java.io.InputStream inputStream, boolean isSilent) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingCollection
public PGPKeyRingCollection keyRingCollection(@Nonnull byte[] bytes, boolean isSilent) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingCollection
public PGPKeyRingCollection keyRingCollection(@Nonnull java.lang.String asciiArmored, boolean isSilent) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
readKeyRing
public static org.bouncycastle.openpgp.PGPKeyRing readKeyRing(@Nonnull java.io.InputStream inputStream) throws java.io.IOExceptionRead aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the givenInputStream. This method will attempt to read at mostMAX_ITERATIONSobjects from the stream before aborting. The firstPGPPublicKeyRingorPGPSecretKeyRingwill be returned.- Parameters:
inputStream- inputStream containing the OpenPGP key or certificate- Returns:
- key ring
- Throws:
java.io.IOException- in case of an IO error
-
readKeyRing
public static org.bouncycastle.openpgp.PGPKeyRing readKeyRing(@Nonnull java.io.InputStream inputStream, int maxIterations) throws java.io.IOExceptionRead aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the givenInputStream. This method will attempt to read at mostmaxIterations
objects from the stream before aborting. The firstPGPPublicKeyRingorPGPSecretKeyRingwill be returned.- Parameters:
inputStream- inputStream containing the OpenPGP key or certificatemaxIterations- maximum number of objects that are read before the method will abort- Returns:
- key ring
- Throws:
java.io.IOException- in case of an IO error
-
readPublicKeyRing
public static org.bouncycastle.openpgp.PGPPublicKeyRing readPublicKeyRing(@Nonnull java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
readPublicKeyRing
public static org.bouncycastle.openpgp.PGPPublicKeyRing readPublicKeyRing(@Nonnull java.io.InputStream inputStream, int maxIterations) throws java.io.IOExceptionRead a public key ring from the providedInputStream. If more than maxIterations PGP packets are encountered before aPGPPublicKeyRingis read, anIOExceptionis thrown.- Parameters:
inputStream- input streammaxIterations- max iterations before abort- Returns:
- public key ring
- Throws:
java.io.IOException- in case of an IO error or exceeding of max iterations
-
readPublicKeyRingCollection
public static org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull java.io.InputStream inputStream) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
readPublicKeyRingCollection
public static org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull java.io.InputStream inputStream, int maxIterations) throws java.io.IOException, org.bouncycastle.openpgp.PGPExceptionRead a public key ring collection from the providedInputStream. If more than maxIterations PGP packets are encountered before the stream is exhausted, anIOExceptionis thrown.- Parameters:
inputStream- input streammaxIterations- max iterations before abort- Returns:
- public key ring collection
- Throws:
java.io.IOException- in case of an IO error or exceeding of max iterationsorg.bouncycastle.openpgp.PGPException- in case of a broken key
-
readSecretKeyRing
public static org.bouncycastle.openpgp.PGPSecretKeyRing readSecretKeyRing(@Nonnull java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
readSecretKeyRing
public static org.bouncycastle.openpgp.PGPSecretKeyRing readSecretKeyRing(@Nonnull java.io.InputStream inputStream, int maxIterations) throws java.io.IOExceptionRead a secret key ring from the providedInputStream. If more than maxIterations PGP packets are encountered before aPGPSecretKeyRingis read, anIOExceptionis thrown.- Parameters:
inputStream- input streammaxIterations- max iterations before abort- Returns:
- public key ring
- Throws:
java.io.IOException- in case of an IO error or exceeding of max iterations
-
readSecretKeyRingCollection
public static org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull java.io.InputStream inputStream) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
readSecretKeyRingCollection
public static org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull java.io.InputStream inputStream, int maxIterations) throws java.io.IOException, org.bouncycastle.openpgp.PGPExceptionRead a secret key ring collection from the providedInputStream. If more than maxIterations PGP packets are encountered before the stream is exhausted, anIOExceptionis thrown.- Parameters:
inputStream- input streammaxIterations- max iterations before abort- Returns:
- secret key ring collection
- Throws:
java.io.IOException- in case of an IO error or exceeding of max iterationsorg.bouncycastle.openpgp.PGPException- in case of a broken secret key
-
readKeyRingCollection
public static PGPKeyRingCollection readKeyRingCollection(@Nonnull java.io.InputStream inputStream, boolean isSilent) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
-