updated Usage in README and cleaned up libsodium bindings
parent
3fa19b57e3
commit
e65a47a4ac
14
README.md
14
README.md
|
@ -39,6 +39,19 @@ nonce, encrypted = Cox.encrypt(data, bob.public, alice.secret)
|
|||
decrypted = Cox.decrypt(encrypted, nonce, alice.public, bob.secret)
|
||||
|
||||
String.new(decrypted) # => "Hello World!"
|
||||
|
||||
|
||||
# Public key signing
|
||||
|
||||
message = "Hello World!"
|
||||
|
||||
signing_pair = Cox::SignKeyPair.new
|
||||
|
||||
# Sign the message
|
||||
signature = Cox.sign(message, signing_pair.secret)
|
||||
|
||||
# And verify
|
||||
Cox.verify(signature, message, signing_pair.public) # => true
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
@ -52,3 +65,4 @@ String.new(decrypted) # => "Hello World!"
|
|||
## Contributors
|
||||
|
||||
- [andrewhamon](https://github.com/andrewhamon) Andrew Hamon - creator, maintainer
|
||||
- [dorkrawk](https://github.com/dorkrawk) Dave Schwantes - contributor
|
||||
|
|
|
@ -3,21 +3,21 @@ module Cox
|
|||
lib LibSodium
|
||||
fun sodium_init() : LibC::Int
|
||||
|
||||
fun crypto_box_publickeybytes() : LibC::SizeT
|
||||
fun crypto_box_secretkeybytes() : LibC::SizeT
|
||||
fun crypto_box_noncebytes() : LibC::SizeT
|
||||
fun crypto_box_macbytes() : LibC::SizeT
|
||||
fun crypto_box_publickeybytes() : LibC::SizeT
|
||||
fun crypto_box_secretkeybytes() : LibC::SizeT
|
||||
fun crypto_box_noncebytes() : LibC::SizeT
|
||||
fun crypto_box_macbytes() : LibC::SizeT
|
||||
fun crypto_sign_publickeybytes() : LibC::SizeT
|
||||
fun crypto_sign_secretkeybytes() : LibC::SizeT
|
||||
fun crypto_sign_bytes() : LibC::SizeT
|
||||
fun crypto_sign_bytes() : LibC::SizeT
|
||||
|
||||
PUBLIC_KEY_BYTES = crypto_box_publickeybytes()
|
||||
SECRET_KEY_BYTES = crypto_box_secretkeybytes()
|
||||
NONCE_BYTES = crypto_box_macbytes()
|
||||
MAC_BYTES = crypto_box_macbytes()
|
||||
PUBLIC_KEY_BYTES = crypto_box_publickeybytes()
|
||||
SECRET_KEY_BYTES = crypto_box_secretkeybytes()
|
||||
NONCE_BYTES = crypto_box_macbytes()
|
||||
MAC_BYTES = crypto_box_macbytes()
|
||||
PUBLIC_SIGN_BYTES = crypto_sign_publickeybytes()
|
||||
SECRET_SIGN_BYTES = crypto_sign_secretkeybytes()
|
||||
SIGNATURE_BYTES = crypto_sign_bytes()
|
||||
SIGNATURE_BYTES = crypto_sign_bytes()
|
||||
|
||||
fun crypto_box_keypair(
|
||||
public_key_output : Pointer(LibC::UChar),
|
||||
|
|
Loading…
Reference in New Issue