Class: ZMQ::Curve
- Inherits:
-
Object
- Object
- ZMQ::Curve
- Defined in:
- lib/0mq/curve.rb
Overview
Secure authentication and confidentiality.
Class Method Summary collapse
-
.keypair ⇒ Object
Generate a keypair.
Class Method Details
.keypair ⇒ Object
Generate a keypair. Returns a hash with the :public and :private keys.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/0mq/curve.rb', line 9 def self.keypair public_key = FFI::MemoryPointer.new :char, 41, true private_key = FFI::MemoryPointer.new :char, 41, true rc = LibZMQ::zmq_curve_keypair public_key, private_key begin ZMQ.error_check true if rc==-1 rescue Errno::EOPNOTSUPP raise Errno::EOPNOTSUPP, "Curve requires libzmq to be compiled with libsodium." end { public: public_key.read_string, private: private_key.read_string } end |