Methods
Public Class methods
Create a new instance of the HMACFactory that uses the given Hash-like to map SSH2 HMAC algorithm names to instances of factories that can instantiate those algorithms.
[ show source ]
# File lib/net/ssh/transport/ossl/hmac-factory.rb, line 32
32: def initialize( algorithms )
33: @algorithms = algorithms
34: end
Public Instance methods
Searches all registered algorithm sets for the one with the given name. Returns nil if no such algorithm exists.
[ show source ]
# File lib/net/ssh/transport/ossl/hmac-factory.rb, line 57
57: def find_algorithm( name )
58: @algorithms.each do |set|
59: return set[name] if set.has_key?( name )
60: end
61:
62: nil
63: end
Return a new instance of the HMAC algorithm for the given name. If no such algorithm exists, a HMACAlgorithmNotFound error will be raised.
[ show source ]
# File lib/net/ssh/transport/ossl/hmac-factory.rb, line 39
39: def get( name, key="" )
40: algo = find_algorithm( name ) or
41: raise HMACAlgorithmNotFound, name
42:
43: return algo.new( key )
44: end
Return the key length of the named HMAC algorithm. If no such algorithm exists, raise HMACAlgorithmNotFound.
[ show source ]
# File lib/net/ssh/transport/ossl/hmac-factory.rb, line 48
48: def get_key_length( name )
49: algo = find_algorithm( name ) or
50: raise HMACAlgorithmNotFound, name
51:
52: return algo.key_length
53: end