Skip to content

Commit 2353bc6

Browse files
feat(external-seed): use positive_bytes
1 parent 0ac1d2f commit 2353bc6

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

tssh-pkcs11/src/pkcs11/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,17 +668,16 @@ pub unsafe extern "C" fn C_GetAttributeValue(
668668
};
669669

670670
let modulus_bytes = match pub_key.key_data() {
671-
ssh_key::public::KeyData::Rsa(rsa_pub_key) => rsa_pub_key.n.as_bytes(),
671+
ssh_key::public::KeyData::Rsa(rsa_pub_key) => {
672+
rsa_pub_key.n.as_positive_bytes().unwrap()
673+
} //Todo:
672674
_ => {
673675
error!("Expected RSA public key");
674676
return CKR_GENERAL_ERROR;
675677
}
676678
};
677679

678680
let mut rsa_key = modulus_bytes;
679-
if modulus_bytes.first() == Some(&0x00) {
680-
rsa_key = &modulus_bytes[1..];
681-
}
682681

683682
if attr.pValue.is_null() {
684683
debug!("CKA_MODULUS size request");

0 commit comments

Comments
 (0)