code: public static Map<String, Object> decrypt(KeenClient client, String apiKey, String scopedKey)
              throws ScopedKeyException {
          try {
              // convert the api key from hex string to byte array
              final byte[] apiKeyBytes = KeenUtils.hexStringToByteArray(apiKey);
  
              // grab first 16 bytes (aka 32 characters of hex) - that's the IV
              String hexedIv = scopedKey.substring(0, 32);
  
              // grab everything else - that's the ciphertext (aka encrypted message)
              String hexedCipherText = scopedKey.substring(32);
  
              // unhex the iv and ciphertext
              byte[] iv = KeenUtils.hexStringToByteArray(hexedIv);
              byte[] cipherText = KeenUtils.hexStringToByteArray(hexedCipherText);
  
              // setup the API key as the secret
              final SecretKey secret = new SecretKeySpec(apiKeyBytes, "AES");
  
              // get the right AES cipher
              final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  
              // initialize the cipher with the right IV
              IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
              cipher.init(Cipher.DECRYPT_MODE, secret, ivParameterSpec);
  
              // do the decryption
              String plainText = new String(cipher.doFinal(cipherText), "UTF-8");
  
              // return the JSON decoded options map
              return client.getJsonHandler().readJson(new StringReader(plainText));
          } catch (Exception e) {
              throw new ScopedKeyException("An error occurred while attempting to decrypt a Scoped Key", e);
          }
      }
docs: Decrypts the given Keen Scoped Key with an API Key and returns the decrypted Scoped Key Options.
  
  @param client  The KeenClient to use for JSON handling.
  @param apiKey    Your Keen API Key.
  @param scopedKey The Scoped Key you want to decrypt.
  @return The decrypted Scoped Key Options.
  @throws ScopedKeyException an error occurred while attempting to decrypt a Scoped Key.