This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A demonstration of the CurveCP handshake protocol. This protocol has many | |
# favorable security properties described at http://curvecp.org. | |
# | |
# In addition to its security advantages, it has the following favorable properties: | |
# * Needs only 2 messages (1 from client, 1 from server) before application | |
# messages can be exchanged (3 before the server can send application messages) | |
# * Does not require the server to keep protocol state between handshake messages. | |
# | |
# An overview of the protocol: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Experimenting with implementing semiprivate keys with RbNaCl | |
require 'rbnacl' | |
require 'hkdf' | |
module Semiprivate | |
class WriteKey | |
def initialize(seed) | |
if seed.bytesize != 32 | |
raise ArgumentError, "seed must be 32 bytes" |