Module: SshTresor::SSHEncoding Private
- Defined in:
- lib/ssh_tresor/ssh_encoding.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Helpers for the SSH agent wire encoding.
SSH strings are length-prefixed binary strings. These helpers are internal to the agent protocol implementation.
Defined Under Namespace
Classes: Reader
Class Method Summary collapse
-
.byte(value) ⇒ String
private
One-byte binary string.
-
.string(value) ⇒ String
private
SSH length-prefixed string.
-
.uint32(value) ⇒ String
private
Network-byte-order integer bytes.
Class Method Details
.byte(value) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns one-byte binary string.
15 16 17 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 15 def byte(value) value.chr.b end |
.string(value) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns SSH length-prefixed string.
27 28 29 30 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 27 def string(value) bytes = value.b uint32(bytes.bytesize) + bytes end |
.uint32(value) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns network-byte-order integer bytes.
21 22 23 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 21 def uint32(value) [value].pack("N") end |