module CryptoToolchain::SRP::Framework
Constants
- EVENT_WHITELIST
Attributes
email[R]
g[R]
k[R]
key[R]
n[R]
password[R]
privkey[R]
pubkey[R]
salt[R]
socket[R]
Public Class Methods
new(n: CryptoToolchain::NIST_P, g: CryptoToolchain::NIST_G, k: 3, email: "charles@goodog.com", password: "i<3porkchops", socket: )
click to toggle source
# File lib/crypto_toolchain/srp/framework.rb, line 7 def initialize(n: CryptoToolchain::NIST_P, g: CryptoToolchain::NIST_G, k: 3, email: "charles@goodog.com", password: "i<3porkchops", socket: ) @n = n @g = g @k = k @email = email @password = password @socket = socket @privkey = rand(1..0xffffffff) % n end
Public Instance Methods
error_received(*args)
click to toggle source
# File lib/crypto_toolchain/srp/framework.rb, line 49 def error_received(*args) raise StandardError.new(args.join(" ")) end
event_loop() { |readline.strip| ... }
click to toggle source
# File lib/crypto_toolchain/srp/framework.rb, line 31 def event_loop begin loop do yield socket.readline.strip end rescue ShutdownSignal # Nothing end end
go!()
click to toggle source
# File lib/crypto_toolchain/srp/framework.rb, line 20 def go! event_loop do |event_string| event_type, *data = event_string.split(DELIMITER) puts "Received #{event_type} #{data}" if DEBUG if !EVENT_WHITELIST.include?(event_type) socket.puts("error|event #{event_type} unknown") and next end send("#{event_type}_received", *data) end end
shutdown_received(*args)
click to toggle source
# File lib/crypto_toolchain/srp/framework.rb, line 41 def shutdown_received(*args) raise ShutdownSignal end
write_message(*args)
click to toggle source
# File lib/crypto_toolchain/srp/framework.rb, line 45 def write_message(*args) socket.puts args.join(DELIMITER) end