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.PGPPublicKeyRing
getKeyRingFromCollection(org.bouncycastle.openpgp.PGPPublicKeyRingCollection collection, java.lang.Long id)
static org.bouncycastle.openpgp.PGPSecretKeyRing
getKeyRingFromCollection(org.bouncycastle.openpgp.PGPSecretKeyRingCollection collection, java.lang.Long id)
static org.bouncycastle.openpgp.PGPPublicKey
getMasterKeyFrom(org.bouncycastle.openpgp.PGPKeyRing ring)
static org.bouncycastle.openpgp.PGPPublicKey
getMasterKeyFrom(org.bouncycastle.openpgp.PGPPublicKeyRing ring)
Return thePGPPublicKey
which is the master key of the key ring.static java.io.InputStream
getPgpDecoderInputStream(byte[] bytes)
static java.io.InputStream
getPgpDecoderInputStream(java.io.InputStream inputStream)
static boolean
keyRingContainsKeyWithId(org.bouncycastle.openpgp.PGPPublicKeyRing ring, long keyId)
static boolean
keyRingContainsKeyWithId(org.bouncycastle.openpgp.PGPSecretKeyRing ring, long keyId)
static org.bouncycastle.openpgp.PGPPublicKeyRingCollection
keyRingsToKeyRingCollection(org.bouncycastle.openpgp.PGPPublicKeyRing... rings)
static org.bouncycastle.openpgp.PGPSecretKeyRingCollection
keyRingsToKeyRingCollection(org.bouncycastle.openpgp.PGPSecretKeyRing... rings)
static org.bouncycastle.openpgp.PGPPublicKeyRing
publicKeyRingFromSecretKeyRing(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
static org.bouncycastle.openpgp.PGPPublicKeyRing
removeUnassociatedKeysFromKeyRing(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.PGPSecretKeyRing
removeUnassociatedKeysFromKeyRing(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.IOException
org.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.IOException
org.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.PGPException
java.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 thePGPPublicKey
which 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)
-
-