Package org.pgpainless.key.parsing
Class KeyRingReader
java.lang.Object
org.pgpainless.key.parsing.KeyRingReader
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bouncycastle.openpgp.PGPKeyRingkeyRing(byte[] bytes) Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given byte array.org.bouncycastle.openpgp.PGPKeyRingkeyRing(InputStream inputStream) org.bouncycastle.openpgp.PGPKeyRingRead aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given ASCII armored string.keyRingCollection(byte[] bytes, boolean isSilent) keyRingCollection(InputStream inputStream, boolean isSilent) keyRingCollection(String asciiArmored, boolean isSilent) org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRing(byte[] bytes) org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRing(InputStream inputStream) org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRing(String asciiArmored) org.bouncycastle.openpgp.PGPPublicKeyRingCollectionpublicKeyRingCollection(byte[] bytes) org.bouncycastle.openpgp.PGPPublicKeyRingCollectionpublicKeyRingCollection(InputStream inputStream) org.bouncycastle.openpgp.PGPPublicKeyRingCollectionpublicKeyRingCollection(String asciiArmored) static org.bouncycastle.openpgp.PGPKeyRingreadKeyRing(InputStream inputStream) static org.bouncycastle.openpgp.PGPKeyRingreadKeyRing(InputStream inputStream, int maxIterations) static PGPKeyRingCollectionreadKeyRingCollection(InputStream inputStream, boolean isSilent) static org.bouncycastle.openpgp.PGPPublicKeyRingreadPublicKeyRing(InputStream inputStream) static org.bouncycastle.openpgp.PGPPublicKeyRingreadPublicKeyRing(InputStream inputStream, int maxIterations) Read a public key ring from the providedInputStream.static org.bouncycastle.openpgp.PGPPublicKeyRingCollectionreadPublicKeyRingCollection(InputStream inputStream) static org.bouncycastle.openpgp.PGPPublicKeyRingCollectionreadPublicKeyRingCollection(InputStream inputStream, int maxIterations) Read a public key ring collection from the providedInputStream.static org.bouncycastle.openpgp.PGPSecretKeyRingreadSecretKeyRing(InputStream inputStream) static org.bouncycastle.openpgp.PGPSecretKeyRingreadSecretKeyRing(InputStream inputStream, int maxIterations) Read a secret key ring from the providedInputStream.static org.bouncycastle.openpgp.PGPSecretKeyRingCollectionreadSecretKeyRingCollection(InputStream inputStream) static org.bouncycastle.openpgp.PGPSecretKeyRingCollectionreadSecretKeyRingCollection(InputStream inputStream, int maxIterations) Read a secret key ring collection from the providedInputStream.org.bouncycastle.openpgp.PGPSecretKeyRingsecretKeyRing(byte[] bytes) org.bouncycastle.openpgp.PGPSecretKeyRingsecretKeyRing(InputStream inputStream) org.bouncycastle.openpgp.PGPSecretKeyRingsecretKeyRing(String asciiArmored) org.bouncycastle.openpgp.PGPSecretKeyRingCollectionsecretKeyRingCollection(byte[] bytes) org.bouncycastle.openpgp.PGPSecretKeyRingCollectionsecretKeyRingCollection(InputStream inputStream) org.bouncycastle.openpgp.PGPSecretKeyRingCollectionsecretKeyRingCollection(String asciiArmored)
-
Field Details
-
MAX_ITERATIONS
public static final int MAX_ITERATIONS- See Also:
-
UTF8
-
-
Constructor Details
-
KeyRingReader
public KeyRingReader()
-
-
Method Details
-
keyRing
public org.bouncycastle.openpgp.PGPKeyRing keyRing(@Nonnull InputStream inputStream) throws IOException - Parameters:
inputStream- inputStream containing the OpenPGP key or certificate- Returns:
- key ring
- Throws:
IOException- in case of an IO error
-
keyRing
Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given byte array.- Parameters:
bytes- byte array containing the OpenPGP key or certificate- Returns:
- key ring
- Throws:
IOException- in case of an IO error
-
keyRing
Read aPGPKeyRing(eitherPGPSecretKeyRingorPGPPublicKeyRing) from the given ASCII armored string.- Parameters:
asciiArmored- ASCII armored OpenPGP key or certificate- Returns:
- key ring
- Throws:
IOException- in case of an IO error
-
publicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRing(@Nonnull InputStream inputStream) throws IOException - Throws:
IOException
-
publicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRing(@Nonnull byte[] bytes) throws IOException - Throws:
IOException
-
publicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRing(@Nonnull String asciiArmored) throws IOException - Throws:
IOException
-
publicKeyRingCollection
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeyRingCollection(@Nonnull InputStream inputStream) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
publicKeyRingCollection
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeyRingCollection(@Nonnull byte[] bytes) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
publicKeyRingCollection
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeyRingCollection(@Nonnull String asciiArmored) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
secretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing(@Nonnull InputStream inputStream) throws IOException - Throws:
IOException
-
secretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing(@Nonnull byte[] bytes) throws IOException - Throws:
IOException
-
secretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing(@Nonnull String asciiArmored) throws IOException - Throws:
IOException
-
secretKeyRingCollection
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeyRingCollection(@Nonnull InputStream inputStream) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
secretKeyRingCollection
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeyRingCollection(@Nonnull byte[] bytes) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
secretKeyRingCollection
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeyRingCollection(@Nonnull String asciiArmored) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingCollection
public PGPKeyRingCollection keyRingCollection(@Nonnull InputStream inputStream, boolean isSilent) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingCollection
public PGPKeyRingCollection keyRingCollection(@Nonnull byte[] bytes, boolean isSilent) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingCollection
public PGPKeyRingCollection keyRingCollection(@Nonnull String asciiArmored, boolean isSilent) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
readKeyRing
public static org.bouncycastle.openpgp.PGPKeyRing readKeyRing(@Nonnull InputStream inputStream) throws IOException Read 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:
IOException- in case of an IO error
-
readKeyRing
public static org.bouncycastle.openpgp.PGPKeyRing readKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException Read 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:
IOException- in case of an IO error
-
readPublicKeyRing
public static org.bouncycastle.openpgp.PGPPublicKeyRing readPublicKeyRing(@Nonnull InputStream inputStream) throws IOException - Throws:
IOException
-
readPublicKeyRing
public static org.bouncycastle.openpgp.PGPPublicKeyRing readPublicKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException Read 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:
IOException- in case of an IO error or exceeding of max iterations
-
readPublicKeyRingCollection
public static org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull InputStream inputStream) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
readPublicKeyRingCollection
public static org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull InputStream inputStream, int maxIterations) throws IOException, org.bouncycastle.openpgp.PGPException Read 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:
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 InputStream inputStream) throws IOException - Throws:
IOException
-
readSecretKeyRing
public static org.bouncycastle.openpgp.PGPSecretKeyRing readSecretKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException Read 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:
IOException- in case of an IO error or exceeding of max iterations
-
readSecretKeyRingCollection
public static org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull InputStream inputStream) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-
readSecretKeyRingCollection
public static org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull InputStream inputStream, int maxIterations) throws IOException, org.bouncycastle.openpgp.PGPException Read 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:
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 InputStream inputStream, boolean isSilent) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOExceptionorg.bouncycastle.openpgp.PGPException
-