Skip to content

Instantly share code, notes, and snippets.

@hjc4869

hjc4869/sslver.cs Secret

Last active Aug 18, 2017
Embed
What would you like to do?
sslver.cs
using System;
using System.Runtime.InteropServices;
namespace sslver
{
class Program
{
// Use OpenSSL_version_num on OpenSSL 1.1 or later.
[DllImport("libcrypto", CallingConvention = CallingConvention.Cdecl)]
public extern static uint SSLeay();
static void Main(string[] args)
{
var ver = SSLeay();
var major = (ver & 0xf0000000) >> 28;
var minor = (ver & 0x0ff00000) >> 20;
var fix = (ver & 0x000ff000) >> 12;
var patchNum = (ver & 0x00000ff0) >> 4;
char? patch = patchNum == 0 ? (char?)null : (char)('a' + patchNum - 1);
Console.WriteLine($"libcrypto {major}.{minor}.{fix}{patch}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.