NOTE: if all you need are Ed25519 digital signatures, consider the ed25519 gem instead which does not require libsodium as a dependency but still works on CRuby and JRuby
In the real world, signatures help uniquely identify people because everyone's signature is unique. Digital signatures work similarly in that they are unique to holders of a private key, but unlike real world signatures, digital signatures are unforgable.
Digital signatures allow you to publish a public key, then you can use your private signing key to sign messages. Others who have your public key can then use it to validate that your messages are actually authentic.
Signer's perspective (RbNaCl::SigningKey):# Generate a new random signing key signing_key = RbNaCl::SigningKey.generate # Serialize key to bytestring - load using RbNaCl::SigningKey.new(bytes) signing_key.to_s # Sign a message with the signing key signature = signing_key.sign(message) # Obtain the verify key for a given signing key verify_key = signing_key.verify_key # Convert the verify key to a string to send it to a third party verify_key.to_sVerifier's perspective (RbNaCl::VerifyKey):
# Create a VerifyKey object from a public key verify_key = RbNaCl::VerifyKey.new(verify_key) # Check the validity of a message's signature # Will raise RbNaCl::BadSignatureError if the signature check fails verify_key.verify(signature, message)
RbNaCl::SigningKey#new
)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4