Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manifest: BER encode the OID #104

Merged
merged 1 commit into from
Aug 13, 2024
Merged

manifest: BER encode the OID #104

merged 1 commit into from
Aug 13, 2024

Conversation

alistair23
Copy link
Collaborator

This patch converts the measurement OID to be BER encoded.

I used the following diff to generate the DER encoded data

diff --git a/src/main.rs b/src/main.rs
index 181ca0f..077ecc3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,6 +8,8 @@
 //! (which is generated from here) or the README
 //!

+use asn1_rs::oid;
+use asn1_rs::ToDer;
 use async_std::task;
 use clap::{Parser, Subcommand};
 use futures::future::join_all;
@@ -629,6 +631,10 @@ fn init_logger() {
 #[async_std::main]
 async fn main() -> Result<(), ()> {
     init_logger();
+
+    let oid = oid!(1.3.6.1.4.1.5127);
+    panic!("OID: {:x?}", oid.to_der_vec());
+
     let cli = Args::parse();

     let cntx_ptr = spdm::initialise_spdm_context();

As DER is a subset of BER we can use the DER output directly.

This patch convers the measurement OID to be BER encoded.

I used the following diff to generate the DER encoded data

```diff
diff --git a/src/main.rs b/src/main.rs
index 181ca0f..077ecc3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,6 +8,8 @@
 //! (which is generated from here) or the README
 //!

+use asn1_rs::oid;
+use asn1_rs::ToDer;
 use async_std::task;
 use clap::{Parser, Subcommand};
 use futures::future::join_all;
@@ -629,6 +631,10 @@ fn init_logger() {
 #[async_std::main]
 async fn main() -> Result<(), ()> {
     init_logger();
+
+    let oid = oid!(1.3.6.1.4.1.5127);
+    panic!("OID: {:x?}", oid.to_der_vec());
+
     let cli = Args::parse();

     let cntx_ptr = spdm::initialise_spdm_context();
```

As DER is a subset of BER [1] we can use the DER output directly.

1: openssl/openssl#7751 (comment)

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@alistair23 alistair23 merged commit 0ec1dca into master Aug 13, 2024
2 checks passed
@alistair23 alistair23 deleted the alistair/oid-ber branch August 13, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants