Support decrypting packets for display

Is there a crypto package which can be used to decrypt packets for display?

In particular I'm interested in the GCM format.

Thanks.

There's no ready-to-use crypto package with GCM support.

However, Jancy (the scripting language of IO Ninja) has high compatibility with C, so you can use (or create) a shared helper library (.so/.dll/.dylib), then call it directly from IO Ninja scripts.

For example, here's how to call OpenSSL for calculation of MD5:

dynamiclib Libcrypto {
	void thin* MD5(
		void thin const* p,
		size_t size,
		void thin* buffer // 16 bytes
	);

	int OPENSSL_buf2hexstr_ex(
		void thin* buffer,
		size_t bufferSize,
		size_t thin* actualSize,
		void thin const* data,
		long dataSize,
		char separator = 0
	);
}

void main() {
	Libcrypto libcrypto;
	libcrypto.open("libcrypto.so");

	char text[] = "abc";
	char md5[16];
	char hex[64];
	libcrypto.lib.MD5(text, sizeof(text) - 1, md5); // -1 for null-terminator
	libcrypto.lib.OPENSSL_buf2hexstr_ex(hex, sizeof(hex), null, md5, sizeof(md5));
	g_logWriter.write($"md5(%s) -> %s\n"(text, hex));
}