Sha256: 32aa0e9f05c9c9ed1b75612db63409111669a81cb6a3d589316fa24458b872db
Contents?: true
Size: 914 Bytes
Versions: 3
Compression:
Stored size: 914 Bytes
Contents
require 'openssl' module SSHScan module Crypto class PublicKey def initialize(key) @key = key @supported = check_supported if @key.is_a?(OpenSSL::PKey::RSA) @data_string = OpenSSL::ASN1::Sequence([ OpenSSL::ASN1::Integer.new(@key.public_key.n), OpenSSL::ASN1::Integer.new(@key.public_key.e) ]) end end def check_supported @key and @key.is_a?(OpenSSL::PKey::RSA) end def is_supported? @supported end def fingerprint_md5 OpenSSL::Digest::MD5.hexdigest(@data_string.to_der).scan(/../).join(':') end def fingerprint_sha1 OpenSSL::Digest::SHA1.hexdigest(@data_string.to_der).scan(/../).join(':') end def fingerprint_sha256 OpenSSL::Digest::SHA256.hexdigest(@data_string.to_der).scan(/../).join(':') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ssh_scan-0.0.16 | lib/ssh_scan/crypto.rb |
ssh_scan-0.0.15 | lib/ssh_scan/crypto.rb |
ssh_scan-0.0.14 | lib/ssh_scan/crypto.rb |