diff --git a/src/ctap/key_material.rs b/src/ctap/key_material.rs
index 1958040..f8a833f 100644
--- a/src/ctap/key_material.rs
+++ b/src/ctap/key_material.rs
@@ -12,10 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-pub const AAGUID: &[u8; 16] = include_bytes!(concat!(env!("OUT_DIR"), "/opensk_aaguid.bin"));
+pub const ATTESTATION_PRIVATE_KEY_LENGTH: usize = 32;
+pub const AAGUID_LENGTH: usize = 16;
+
+pub const AAGUID: &[u8; AAGUID_LENGTH] = include_bytes!(concat!(env!("OUT_DIR"), "/opensk_aaguid.bin"));
pub const ATTESTATION_CERTIFICATE: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/opensk_cert.bin"));
-pub const ATTESTATION_PRIVATE_KEY: &[u8; 32] =
+pub const ATTESTATION_PRIVATE_KEY: &[u8; ATTESTATION_PRIVATE_KEY_LENGTH] =
include_bytes!(concat!(env!("OUT_DIR"), "/opensk_pkey.bin"));
diff --git a/src/ctap/storage.rs b/src/ctap/storage.rs
index 127dc23..5793e6c 100644
--- a/src/ctap/storage.rs
+++ b/src/ctap/storage.rs
@@ -15,9 +15,9 @@
#[cfg(feature = "with_ctap2_1")]
use crate::ctap::data_formats::{extract_array, extract_text_string};
use crate::ctap::data_formats::{CredentialProtectionPolicy, PublicKeyCredentialSource};
+use crate::ctap::key_material;
use crate::ctap::pin_protocol_v1::PIN_AUTH_LENGTH;
use crate::ctap::status_code::Ctap2StatusCode;
-use crate::ctap::{key_material, USE_BATCH_ATTESTATION};
use crate::embedded_flash::{self, StoreConfig, StoreEntry, StoreError};
use alloc::string::String;
#[cfg(any(test, feature = "ram_storage", feature = "with_ctap2_1"))]
@@ -76,8 +76,6 @@ const MIN_PIN_LENGTH_RP_IDS: usize = 9;
const NUM_TAGS: usize = 10;
const MAX_PIN_RETRIES: u8 = 8;
-const ATTESTATION_PRIVATE_KEY_LENGTH: usize = 32;
-const AAGUID_LENGTH: usize = 16;
#[cfg(feature = "with_ctap2_1")]
const DEFAULT_MIN_PIN_LENGTH: u8 = 4;
// TODO(kaczmarczyck) use this for the minPinLength extension
@@ -231,17 +229,16 @@ impl PersistentStore {
})
.unwrap();
}
- // The following 3 entries are meant to be written by vendor-specific commands.
- if USE_BATCH_ATTESTATION {
- if self.store.find_one(&Key::AttestationPrivateKey).is_none() {
- self.set_attestation_private_key(key_material::ATTESTATION_PRIVATE_KEY)
- .unwrap();
- }
- if self.store.find_one(&Key::AttestationCertificate).is_none() {
- self.set_attestation_certificate(key_material::ATTESTATION_CERTIFICATE)
- .unwrap();
- }
+ // The following 2 entries are meant to be written by vendor-specific commands.
+ if self.store.find_one(&Key::AttestationPrivateKey).is_none() {
+ self.set_attestation_private_key(key_material::ATTESTATION_PRIVATE_KEY)
+ .unwrap();
}
+ if self.store.find_one(&Key::AttestationCertificate).is_none() {
+ self.set_attestation_certificate(key_material::ATTESTATION_CERTIFICATE)
+ .unwrap();
+ }
+
if self.store.find_one(&Key::Aaguid).is_none() {
self.set_aaguid(key_material::AAGUID).unwrap();
}
@@ -525,20 +522,24 @@ impl PersistentStore {
pub fn attestation_private_key(
&self,
- ) -> Result