Make application url and label configurable

This commit is contained in:
Sosthène Guédon
2024-03-01 14:29:40 +01:00
committed by Nicolas Stalder
parent 4780077443
commit 6ea1083a07
3 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ pub const PIV_AID: iso7816::Aid =
pub const DERIVED_PIV_AID: [u8; 11] = hex!("A000000308 00002000 0100");
pub const APPLICATION_LABEL: &[u8] = b"SoloKeys PIV";
pub const APPLICATION_URL: &[u8] = b"https://github.com/solokeys/piv-authenticator";
pub const NITROKEY_APPLICATION_LABEL: &[u8] = b"Nitrokey PIV";
pub const NITROKEY_APPLICATION_URL: &[u8] = b"https://github.com/Nitrokey/piv-authenticator";
pub const YUBICO_DEFAULT_MANAGEMENT_KEY: &[u8; 24] = &hex!(
"
+13 -3
View File
@@ -46,19 +46,29 @@ use state::{AdministrationAlgorithm, CommandCache, KeyWithAlg, LoadedState, Stat
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Options {
storage: Location,
label: &'static [u8],
url: &'static [u8],
}
impl Default for Options {
fn default() -> Self {
Self {
storage: Location::External,
label: NITROKEY_APPLICATION_LABEL,
url: NITROKEY_APPLICATION_URL,
}
}
}
impl Options {
pub fn storage(self, storage: Location) -> Self {
Self { storage }
Self { storage, ..self }
}
pub fn url(self, url: &'static [u8]) -> Self {
Self { url, ..self }
}
pub fn label(self, label: &'static [u8]) -> Self {
Self { label, ..self }
}
}
@@ -118,8 +128,8 @@ where
info!("selecting PIV maybe");
let application_property_template = piv_types::ApplicationPropertyTemplate::default()
.with_application_label(APPLICATION_LABEL)
.with_application_url(APPLICATION_URL)
.with_application_label(self.options.label)
.with_application_url(self.options.url)
.with_supported_cryptographic_algorithms(&[
Tdes, Aes256, P256, Ed25519, X25519, Rsa2048,
]);
+3 -3
View File
@@ -479,10 +479,10 @@ impl IoCmd {
"
61 66 // Card application property template
4f 06 000010000100 // Application identifier
50 0c 536f6c6f4b65797320504956 // Application label = b\"Solokeys PIV\"
50 0c 4e6974726f6b657920504956 // Application label = b\"Nitrokey PIV\"
// URL = b\"https://github.com/solokeys/piv-authenticator\"
5f50 2d 68747470733a2f2f6769746875622e636f6d2f736f6c6f6b6579732f7069762d61757468656e74696361746f72
// URL = b\"https://github.com/Nitrokey/piv-authenticator\"
5f50 2d 68747470733a2f2f6769746875622e636f6d2f4e6974726f6b65792f7069762d61757468656e74696361746f72
// Cryptographic Algorithm Identifier Template
ac 15