-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
yhsm-audit
for working with yubihsm2 audit log objects & encodi…
…ngs.
- Loading branch information
Showing
5 changed files
with
492 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
[package] | ||
name = "yubihsm-audit" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
anyhow.workspace = true | ||
clap.workspace = true | ||
derive_more.workspace = true | ||
env_logger.workspace = true | ||
hex.workspace = true | ||
log.workspace = true | ||
ron.workspace = true | ||
serde.workspace = true | ||
serde_json.workspace = true | ||
sha2.workspace = true | ||
yubihsm.workspace = true |
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,41 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use clap::ValueEnum; | ||
use std::fmt; | ||
|
||
#[derive(Clone, Debug, ValueEnum)] | ||
pub enum Kind { | ||
LogEntries, | ||
LogEntry, | ||
} | ||
|
||
impl fmt::Display for Kind { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match *self { | ||
Kind::LogEntries => write!(f, "LogEntries"), | ||
Kind::LogEntry => write!(f, "LogEntry"), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, ValueEnum)] | ||
pub enum Encoding { | ||
// The binary serializer from upstream is not exposed publicly. | ||
// We maintain a patch here: | ||
// https://github.com/oxidecomputer/yubihsm.rs/tree/v0.42.0-with-audit | ||
Bin, | ||
Json, | ||
Ron, | ||
} | ||
|
||
impl fmt::Display for Encoding { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match *self { | ||
Encoding::Bin => write!(f, "bin"), | ||
Encoding::Json => write!(f, "json"), | ||
Encoding::Ron => write!(f, "ron"), | ||
} | ||
} | ||
} |
Oops, something went wrong.