summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorStuart Stock <stuart@int08h.com>2017-06-19 22:01:46 -0500
committerStuart Stock <stuart@int08h.com>2017-06-19 22:01:46 -0500
commitdc17df4885cef546ed44d14a291ba782b82d93ed (patch)
tree8a593164f7d678fcae4501945891eb8bfcb3cfa6 /src/lib.rs
parent13d53fec92fddae9c312d323db81bbcb97adbe21 (diff)
downloadroughenough-dc17df4885cef546ed44d14a291ba782b82d93ed.zip
begin work on server
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs52
1 files changed, 49 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 7f339c1..4a6d2fa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1,51 @@
+//!
+//! An implementation of the [Roughtime](https://roughtime.googlesource.com/roughtime)
+//! secure time synchronization protocol.
+//!
+
extern crate byteorder;
-pub mod error;
-pub mod tag;
-pub mod message;
+mod error;
+mod tag;
+mod message;
+
+pub mod hex;
+
+pub use error::Error;
+pub use tag::Tag;
+pub use message::RtMessage;
+
+// Constants and magic numbers of the Roughtime protocol
+//
+ /// Minimum size (in bytes) of a client request
+ pub const MIN_REQUEST_LENGTH: u32 = 1024;
+
+ /// Minimum size (in bytes) of seeds used to derive private keys
+ pub const MIN_SEED_LENGTH: u32 = 32;
+
+ /// Size (in bytes) of an Ed25519 public key
+ pub const PUBKEY_LENGTH: u32 = 32;
+
+ /// Size (in bytes) of the client's nonce
+ pub const NONCE_LENGTH: u32 = 64;
+
+ /// Size (in bytes) of an Ed25519 signature
+ pub const SIGNATURE_LENGTH: u32 = 64;
+
+ /// Size (in bytes) of server's timestamp value
+ pub const TIMESTAMP_LENGTH: u32 = 8;
+
+ /// Size (in bytes) of server's time uncertainty value
+ pub const RADIUS_LENGTH: u32 = 4;
+
+ /// Prefixed to the server's certificate before generating or verifying certificate's signature
+ pub const CERTIFICATE_CONTEXT: &str = "RoughTime v1 delegation signature--\x00";
+
+ /// Prefixed to the server's response before generating or verifying the server's signature
+ pub const SIGNED_RESPONSE_CONTEXT: &str = "RoughTime v1 response signature\x00";
+
+ /// Value prepended to leaves prior to hashing
+ pub const TREE_LEAF_TWEAK: u8 = 0x00;
+
+ /// Value prepended to nodes prior to hashing
+ pub const TREE_NODE_TWEAK: u8 = 0x01;