-
-
Save hjc4869/e7cf201e90b960c7c4f2af6902da3fc8 to your computer and use it in GitHub Desktop.
sslver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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