| Class | OpenSSL::PKey::DH |
| In: |
lib/net/ssh/transport/openssl.rb
lib/net/ssh/transport/openssl.rb |
| Parent: | Object |
Determines whether the pub_key for this key is valid. (This algorithm lifted more-or-less directly from OpenSSH, dh.c, dh_pub_is_valid.)
# File lib/net/ssh/transport/openssl.rb, line 43
43: def valid?
44: return false if pub_key.nil? || pub_key < 0
45: bits_set = 0
46: pub_key.num_bits.times { |i| bits_set += 1 if pub_key.bit_set?(i) }
47: return ( bits_set > 1 && pub_key < p )
48: end
Determines whether the pub_key for this key is valid. (This algorithm lifted more-or-less directly from OpenSSH, dh.c, dh_pub_is_valid.)
# File lib/net/ssh/transport/openssl.rb, line 43
43: def valid?
44: return false if pub_key.nil? || pub_key < 0
45: bits_set = 0
46: pub_key.num_bits.times { |i| bits_set += 1 if pub_key.bit_set?(i) }
47: return ( bits_set > 1 && pub_key < p )
48: end