Class PublicKeyUtils

java.lang.Object
org.bouncycastle.bcpg.PublicKeyUtils

public class PublicKeyUtils extends Object
Utility methods related to OpenPGP public key algorithms.
  • Constructor Details

    • PublicKeyUtils

      public PublicKeyUtils()
  • Method Details

    • isSigningAlgorithm

      public static boolean isSigningAlgorithm(int publicKeyAlgorithm)
      Return true, if the public key algorithm that corresponds to the given ID is capable of signing.
      Parameters:
      publicKeyAlgorithm - public key algorithm id
      Returns:
      true if algorithm can sign
    • isEncryptionAlgorithm

      public static boolean isEncryptionAlgorithm(int publicKeyAlgorithm)
      Return true, if the public key algorithm that corresponds to the given ID is capable of encryption.
      Parameters:
      publicKeyAlgorithm - public key algorithm id
      Returns:
      true if algorithm can encrypt
    • isX25519Key

      public static boolean isX25519Key(PublicKeyPacket publicKeyPacket)
      Return true, if the passed in PublicKeyPacket is based on X25519, either the legacy variant via PublicKeyAlgorithmTags.ECDH over curve25519, or the modern PublicKeyAlgorithmTags.X25519.
      Parameters:
      publicKeyPacket - public key packet
      Returns:
      true if the key is an X25519 key