Package org.pgpainless.util
Class BCUtil
- java.lang.Object
-
- org.pgpainless.util.BCUtil
-
public class BCUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BCUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getDecodedBytes(byte[] bytes)static byte[]getDecodedBytes(java.io.InputStream inputStream)static org.bouncycastle.openpgp.PGPPublicKeyRinggetKeyRingFromCollection(org.bouncycastle.openpgp.PGPPublicKeyRingCollection collection, java.lang.Long id)static org.bouncycastle.openpgp.PGPSecretKeyRinggetKeyRingFromCollection(org.bouncycastle.openpgp.PGPSecretKeyRingCollection collection, java.lang.Long id)static org.bouncycastle.openpgp.PGPPublicKeygetMasterKeyFrom(org.bouncycastle.openpgp.PGPKeyRing ring)static org.bouncycastle.openpgp.PGPPublicKeygetMasterKeyFrom(org.bouncycastle.openpgp.PGPPublicKeyRing ring)Return thePGPPublicKeywhich is the master key of the key ring.static java.io.InputStreamgetPgpDecoderInputStream(byte[] bytes)static java.io.InputStreamgetPgpDecoderInputStream(java.io.InputStream inputStream)static booleankeyRingContainsKeyWithId(org.bouncycastle.openpgp.PGPPublicKeyRing ring, long keyId)static booleankeyRingContainsKeyWithId(org.bouncycastle.openpgp.PGPSecretKeyRing ring, long keyId)static org.bouncycastle.openpgp.PGPPublicKeyRingCollectionkeyRingsToKeyRingCollection(org.bouncycastle.openpgp.PGPPublicKeyRing... rings)static org.bouncycastle.openpgp.PGPSecretKeyRingCollectionkeyRingsToKeyRingCollection(org.bouncycastle.openpgp.PGPSecretKeyRing... rings)static org.bouncycastle.openpgp.PGPPublicKeyRingpublicKeyRingFromSecretKeyRing(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)static org.bouncycastle.openpgp.PGPPublicKeyRingremoveUnassociatedKeysFromKeyRing(org.bouncycastle.openpgp.PGPPublicKeyRing ring, org.bouncycastle.openpgp.PGPPublicKey masterKey)Remove all keys from the key ring, are either not having a subkey signature from the master key (identified bymasterKeyId), or are revoked ("normal" key revocation, as well as subkey revocation).static org.bouncycastle.openpgp.PGPSecretKeyRingremoveUnassociatedKeysFromKeyRing(org.bouncycastle.openpgp.PGPSecretKeyRing ring, org.bouncycastle.openpgp.PGPPublicKey masterKey)Remove all keys from the key ring, are either not having a subkey signature from the master key (identified bymasterKeyId), or are revoked ("normal" key revocation, as well as subkey revocation).static java.util.Set<java.lang.Long>signingKeyIds(org.bouncycastle.openpgp.PGPSecretKeyRing ring)
-
-
-
Method Detail
-
keyRingsToKeyRingCollection
public static org.bouncycastle.openpgp.PGPPublicKeyRingCollection keyRingsToKeyRingCollection(@Nonnull org.bouncycastle.openpgp.PGPPublicKeyRing... rings) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
keyRingsToKeyRingCollection
public static org.bouncycastle.openpgp.PGPSecretKeyRingCollection keyRingsToKeyRingCollection(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRing... rings) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
publicKeyRingFromSecretKeyRing
public static org.bouncycastle.openpgp.PGPPublicKeyRing publicKeyRingFromSecretKeyRing(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys) throws org.bouncycastle.openpgp.PGPException, java.io.IOException- Throws:
org.bouncycastle.openpgp.PGPExceptionjava.io.IOException
-
getKeyRingFromCollection
public static org.bouncycastle.openpgp.PGPSecretKeyRing getKeyRingFromCollection(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRingCollection collection, @Nonnull java.lang.Long id) throws org.bouncycastle.openpgp.PGPException- Throws:
org.bouncycastle.openpgp.PGPException
-
getKeyRingFromCollection
public static org.bouncycastle.openpgp.PGPPublicKeyRing getKeyRingFromCollection(@Nonnull org.bouncycastle.openpgp.PGPPublicKeyRingCollection collection, @Nonnull java.lang.Long id) throws org.bouncycastle.openpgp.PGPException- Throws:
org.bouncycastle.openpgp.PGPException
-
getPgpDecoderInputStream
public static java.io.InputStream getPgpDecoderInputStream(@Nonnull byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
getPgpDecoderInputStream
public static java.io.InputStream getPgpDecoderInputStream(@Nonnull java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
getDecodedBytes
public static byte[] getDecodedBytes(@Nonnull byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
getDecodedBytes
public static byte[] getDecodedBytes(@Nonnull java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
removeUnassociatedKeysFromKeyRing
public static org.bouncycastle.openpgp.PGPPublicKeyRing removeUnassociatedKeysFromKeyRing(@Nonnull org.bouncycastle.openpgp.PGPPublicKeyRing ring, @Nonnull org.bouncycastle.openpgp.PGPPublicKey masterKey)Remove all keys from the key ring, are either not having a subkey signature from the master key (identified bymasterKeyId), or are revoked ("normal" key revocation, as well as subkey revocation).- Parameters:
ring- key ringmasterKey- master key- Returns:
- "cleaned" key ring
-
removeUnassociatedKeysFromKeyRing
public static org.bouncycastle.openpgp.PGPSecretKeyRing removeUnassociatedKeysFromKeyRing(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRing ring, @Nonnull org.bouncycastle.openpgp.PGPPublicKey masterKey)Remove all keys from the key ring, are either not having a subkey signature from the master key (identified bymasterKeyId), or are revoked ("normal" key revocation, as well as subkey revocation).- Parameters:
ring- key ringmasterKey- master key- Returns:
- "cleaned" key ring
-
getMasterKeyFrom
public static org.bouncycastle.openpgp.PGPPublicKey getMasterKeyFrom(@Nonnull org.bouncycastle.openpgp.PGPPublicKeyRing ring)Return thePGPPublicKeywhich is the master key of the key ring.- Parameters:
ring- key ring- Returns:
- master key
-
getMasterKeyFrom
public static org.bouncycastle.openpgp.PGPPublicKey getMasterKeyFrom(@Nonnull org.bouncycastle.openpgp.PGPKeyRing ring)
-
signingKeyIds
public static java.util.Set<java.lang.Long> signingKeyIds(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRing ring)
-
keyRingContainsKeyWithId
public static boolean keyRingContainsKeyWithId(@Nonnull org.bouncycastle.openpgp.PGPPublicKeyRing ring, long keyId)
-
keyRingContainsKeyWithId
public static boolean keyRingContainsKeyWithId(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRing ring, long keyId)
-
-