-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch provides the foundations for the various components of libacc to be formed. Signed-off-by: Amy Parker <amy@amyip.net>
- Loading branch information
Showing
6 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "libacc" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// Generates AES-encrypted packet from key. | ||
/// Returns the encrypted packet with appended nonce, | ||
/// which is really only the first 96 bits of the last 16 bytes. | ||
fn encapsulate(pkt: &[u8], key: &[u8]) -> Vec<u8> { | ||
unimplemented!() | ||
} | ||
|
||
/// Attempts to decrypt AES with a given key. | ||
/// If this fails, returns Err. | ||
/// On success, returns Ok(Vec<u8>) containing the packet. | ||
fn reveal(pkt: &[u8]) -> Result<Vec<u8>, std::io::Error> { | ||
unimplemented!() | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// No definitions yet. | ||
// Need to define the encapsulate and reveal functions. | ||
// Because BSON depends on the protocol version, | ||
// need to develop an Enum<Struct, Struct, ...> to | ||
// work based on the protocol version. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod aes; | ||
mod bson; | ||
mod padding; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Applies new padding to a BSON packet. | ||
// Returns the padded packet. | ||
fn encapsulate(pkt: &[u8]) -> Vec<u8> { | ||
unimplemented!() | ||
} | ||
|
||
/// Strips the padding from an unencrypted packet. | ||
/// Returns Ok(Vec<u8>) containing the BSON if successful. | ||
/// Returns Err if the packet is invalid. | ||
fn reveal(pkt: &[u8]) -> Result<Vec<u8>, std::io::Error> { | ||
unimplemented!() | ||
} |