Skip to content

Commit

Permalink
Merge 38faa1a into 5b12adb
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Oct 2, 2013
2 parents 5b12adb + 38faa1a commit 4d041e7
Show file tree
Hide file tree
Showing 26 changed files with 638 additions and 595 deletions.
73 changes: 51 additions & 22 deletions lib/rbnacl.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# encoding: binary
require "rbnacl/version"
require "rbnacl/nacl"
require "rbnacl/serializable"
require "rbnacl/key_comparator"
require "rbnacl/auth"
require "rbnacl/util"
require "rbnacl/random"
require "rbnacl/random_nonce_box"
require "rbnacl/test_vectors"

module RbNaCl
# Oh no, something went wrong!
#
Expand All @@ -18,29 +28,48 @@ class LengthError < ArgumentError; end
# This indicates that an attempt has been made to use something (probably a key)
# with an incorrect primitive
class IncorrectPrimitiveError < ArgumentError; end
end

require "rbnacl/nacl"
require "rbnacl/version"
require "rbnacl/serializable"
require "rbnacl/keys/key_comparator"
require "rbnacl/keys/private_key"
require "rbnacl/keys/public_key"
require "rbnacl/keys/signing_key"
require "rbnacl/keys/verify_key"
require "rbnacl/box"
require "rbnacl/secret_box"
require "rbnacl/hash"
require "rbnacl/hash/blake2b"
require "rbnacl/util"
require "rbnacl/auth"
require "rbnacl/hmac/sha512256"
require "rbnacl/hmac/sha256"
require "rbnacl/auth/one_time"
require "rbnacl/random"
require "rbnacl/point"
require "rbnacl/random_nonce_box"
require "rbnacl/test_vectors"
# The signature was forged or otherwise corrupt
class BadSignatureError < CryptoError; end

# Public Key Encryption (Box): Curve25519XSalsa20Poly1305
require "rbnacl/boxes/curve25519xsalsa20poly1305"
require "rbnacl/boxes/curve25519xsalsa20poly1305/private_key"
require "rbnacl/boxes/curve25519xsalsa20poly1305/public_key"

# Secret Key Encryption (SecretBox): XSalsa20Poly1305
require "rbnacl/secret_boxes/xsalsa20poly1305"

# Digital Signatures: Ed25519
require "rbnacl/signatures/ed25519/signing_key"
require "rbnacl/signatures/ed25519/verify_key"

# Group Elements: Curve25519
require "rbnacl/group_elements/curve25519"

# One-time Authentication: Poly1305
require "rbnacl/authenticators/poly1305"

# Hash functions: SHA256/512 and Blake2b
require "rbnacl/hash"
require "rbnacl/hash/blake2b"

# HMAC: SHA256 and SHA512256
require "rbnacl/hmac/sha256"
require "rbnacl/hmac/sha512256"

#
# Bind aliases used by the public API
#
Box = Boxes::Curve25519XSalsa20Poly1305
PrivateKey = Boxes::Curve25519XSalsa20Poly1305::PrivateKey
PublicKey = Boxes::Curve25519XSalsa20Poly1305::PublicKey
SecretBox = SecretBoxes::XSalsa20Poly1305
SigningKey = Signatures::Ed25519::SigningKey
VerifyKey = Signatures::Ed25519::VerifyKey
GroupElement = GroupElements::Curve25519
OneTimeAuth = Authenticators::Poly1305
end

# Select platform-optimized versions of algorithms
Thread.exclusive { RbNaCl::NaCl.sodium_init }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: binary
module RbNaCl
class Auth
module Authenticators
# Computes an authenticator using poly1305
#
# The authenticator can be used at a later time to verify the provenance of
Expand All @@ -17,7 +17,7 @@ class Auth
# can also create them.
#
# @see http://nacl.cr.yp.to/onetimeauth.html
class OneTime < self
class Poly1305 < Auth
# Number of bytes in a valid key
KEYBYTES = NaCl::ONETIME_KEYBYTES

Expand Down
171 changes: 0 additions & 171 deletions lib/rbnacl/box.rb

This file was deleted.

Loading

0 comments on commit 4d041e7

Please sign in to comment.