#[non_exhaustive]pub struct Pkcs11KeyStoreOptions {
pub sessions: usize,
pub rsa_algorithm: JwsAlgorithm,
pub algorithms: Option<Vec<JwsAlgorithm>>,
}pkcs11 only.Expand description
How a Pkcs11KeyStore uses its token.
§Examples
use identity_kit::jose::JwsAlgorithm;
use identity_kit::keys::Pkcs11KeyStoreOptions;
let options = Pkcs11KeyStoreOptions::new()
.sessions(2)
.rsa_algorithm(JwsAlgorithm::PS256)
.algorithms([JwsAlgorithm::ES256, JwsAlgorithm::PS256]);
assert_eq!(options.sessions, 2);
assert_eq!(options.rsa_algorithm, JwsAlgorithm::PS256);
assert_eq!(
options.algorithms,
Some(vec![JwsAlgorithm::ES256, JwsAlgorithm::PS256])
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.sessions: usizeHow many sessions the store keeps open at most, 4 by default.
Sessions are opened as needed, logged in and reused; an operation waits for a session
when all of them are in use. At least 1.
rsa_algorithm: JwsAlgorithmThe algorithm RSA keys sign with, RS256 by default: RS256 (CKM_RSA_PKCS) or
PS256 (CKM_RSA_PKCS_PSS).
A PKCS#11 RSA key does not record which padding it is for, and a key signs with one
algorithm only, so the store settles it for all RSA keys of the token: the public JWK
of every RSA key carries this alg, sign accepts only this algorithm for an RSA key
and generate makes RSA keys for it.
algorithms: Option<Vec<JwsAlgorithm>>The algorithms the store offers, out of those the module signs with; None for all of
them.
The store derives what it can sign with from the module’s mechanism list (see
Pkcs11KeyStore); this narrows that list, for a module whose CKM_ECDSA cannot take
secp256k1 for instance. Algorithms the module does not sign with are left out.
Implementations§
Source§impl Pkcs11KeyStoreOptions
impl Pkcs11KeyStoreOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
The defaults: four sessions, RS256 for RSA keys, every algorithm the module signs with.
Sourcepub fn rsa_algorithm(self, alg: JwsAlgorithm) -> Self
pub fn rsa_algorithm(self, alg: JwsAlgorithm) -> Self
Sets rsa_algorithm.
Sourcepub fn algorithms(
self,
algorithms: impl IntoIterator<Item = JwsAlgorithm>,
) -> Self
pub fn algorithms( self, algorithms: impl IntoIterator<Item = JwsAlgorithm>, ) -> Self
Sets algorithms.
Trait Implementations§
Source§impl Clone for Pkcs11KeyStoreOptions
impl Clone for Pkcs11KeyStoreOptions
Source§impl Debug for Pkcs11KeyStoreOptions
impl Debug for Pkcs11KeyStoreOptions
Source§impl Default for Pkcs11KeyStoreOptions
impl Default for Pkcs11KeyStoreOptions
impl Eq for Pkcs11KeyStoreOptions
Source§impl PartialEq for Pkcs11KeyStoreOptions
impl PartialEq for Pkcs11KeyStoreOptions
impl StructuralPartialEq for Pkcs11KeyStoreOptions
Auto Trait Implementations§
impl Freeze for Pkcs11KeyStoreOptions
impl RefUnwindSafe for Pkcs11KeyStoreOptions
impl Send for Pkcs11KeyStoreOptions
impl Sync for Pkcs11KeyStoreOptions
impl Unpin for Pkcs11KeyStoreOptions
impl UnsafeUnpin for Pkcs11KeyStoreOptions
impl UnwindSafe for Pkcs11KeyStoreOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.