-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
When requesting StartDate
or EndDate
attributes on a key we get a segmentation fault. For example, running the following unit test:
#[test]
#[serial]
fn aes_key() -> Result<()> {
let (pkcs11, slot) = init_pins();
// set flags
let mut flags = SessionFlags::new();
let _ = flags.set_rw_session(true).set_serial_session(true);
// open a session
let session = pkcs11.open_session_no_callback(slot, flags)?;
// log in the session
session.login(UserType::User, Some(USER_PIN))?;
// get mechanism
let mechanism = Mechanism::AesKeyGen;
// pub key template
let key_template = vec![
Attribute::Class(ObjectClass::SECRET_KEY),
Attribute::Token(true),
Attribute::Sensitive(true),
Attribute::ValueLen(16.into()),
Attribute::KeyType(KeyType::AES),
Attribute::Label(b"testAES".to_vec()),
Attribute::Private(true),
];
// generate a key pair
let key = session.generate_key(&mechanism, &key_template)?;
let attributes_result =
session.get_attributes(key, &[AttributeType::EndDate, AttributeType::StartDate]);
match attributes_result {
Ok(attributes) => println!("working with version: {:?}", attributes),
Err(e) => println!("error getting attributes: {:?}", e),
}
Ok(())
}
results (for me) in a SIGSEGV.
Metadata
Metadata
Assignees
Labels
No labels