Class: Cisco::Encryption
- Inherits:
-
Object
- Object
- Cisco::Encryption
- Defined in:
- lib/cisco_node_utils/cisco_cmn_utils.rb
Overview
Encryption - helper class for translating encryption type CLI
Class Method Summary collapse
-
.cli_to_symbol(cli) ⇒ Object
password encryption types.
- .symbol_to_cli(symbol) ⇒ Object
Class Method Details
.cli_to_symbol(cli) ⇒ Object
password encryption types
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cisco_node_utils/cisco_cmn_utils.rb', line 25 def self.cli_to_symbol(cli) case cli when '0', 0, 'clear' :cleartext when '3', 3 :"3des" # yuck :-( when '5', 5, 'encrypted' :md5 when '6', 6 :aes when '7', 7 :cisco_type_7 else fail KeyError end end |
.symbol_to_cli(symbol) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cisco_node_utils/cisco_cmn_utils.rb', line 42 def self.symbol_to_cli(symbol) symbol = symbol.downcase if symbol.is_a? String case symbol when :cleartext, :none, 'cleartext', 'none', '0', 0 '0' when :"3des", '3des', '3', 3 '3' when :md5, 'md5', '5', 5 '5' when :aes, 'aes', '6', 6 '6' when :cisco_type_7, :type_7, 'cisco_type_7', 'type_7', '7', 7 '7' else fail KeyError end end |