diff --git a/src/constants.rs b/src/constants.rs index 0757435..dda9c24 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -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!( " diff --git a/src/lib.rs b/src/lib.rs index 477830a..ba770e0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, ]); diff --git a/tests/command_response.rs b/tests/command_response.rs index 9f36b14..14f8da5 100644 --- a/tests/command_response.rs +++ b/tests/command_response.rs @@ -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