module PuTTY::Key::OpenSSL::Version
OpenSSL
version helper methods.
@private
Public Class Methods
openssl?(major = nil, minor = 0, fix = 0, patch = 0)
click to toggle source
Determines if the Ruby OpenSSL
wrapper is using the OpenSSL
library (not LibreSSL and not JRuby) and if the version matches the required version.
@param major [Integer] The required major version. nil
if any version of OpenSSL
is sufficient. @param minor [Integer] The required minor version. @param fix [Integer] The required fix version. @param patch [Integer] The required patch version. @return [Boolean] true
if the requirements are met, otherwise false
.
# File lib/putty/key/openssl.rb, line 44 def openssl?(major = nil, minor = 0, fix = 0, patch = 0) return false if ::OpenSSL::OPENSSL_VERSION.include?('LibreSSL') return false if ::OpenSSL::OPENSSL_VERSION.include?('JRuby') return true unless major required_version = major * 0x10000000 + minor * 0x100000 + fix * 0x1000 + patch * 0x10 ::OpenSSL::OPENSSL_VERSION_NUMBER >= required_version end