Class Key

java.lang.Object
ch.threema.apitool.types.Key

public class Key extends Object
Encapsulates an asymmetric key, either public or private.
  • Field Details

  • Constructor Details

    • Key

      public Key(String type, byte[] key)
  • Method Details

    • decodeKey

      public static Key decodeKey(String encodedKey) throws InvalidKeyException
      Decodes and validates an encoded key. Encoded key format: type:hex_key
      Parameters:
      encodedKey - an encoded key
      Throws:
      InvalidKeyException
    • decodeKey

      public static Key decodeKey(String encodedKey, String expectedKeyType) throws InvalidKeyException
      Decodes and validates an encoded key. Encoded key format: type:hex_key
      Parameters:
      encodedKey - an encoded key
      expectedKeyType - the expected type of the key
      Throws:
      InvalidKeyException
    • encode

      public String encode()
      Encodes a key.
      Returns:
      an encoded key