Question: How to correctly handle a Session
#243
Replies: 9 comments
-
If there's one active this may be problematic 🤔 can you have a reference to the Session in your struct? CCing @baloo since they've also designed a RustCrypto wrapper around this. |
Beta Was this translation helpful? Give feedback.
-
My unfinished prototype can be found here: #192 but essentially, my approach was for the signer to carry a
I don't think the thread-safety garantees or uniqueness of the session are defined at the spec level. I know the two implementation I worked with in the past had varying behavior. One of them you had to opt-in to have thread-safety. |
Beta Was this translation helpful? Give feedback.
-
On my case, the Signer trait in defined insite |
Beta Was this translation helpful? Give feedback.
-
Ack. But |
Beta Was this translation helpful? Give feedback.
-
I get this error, but I'll check further
|
Beta Was this translation helpful? Give feedback.
-
Hmm... sounds like it may need wrapping in an |
Beta Was this translation helpful? Give feedback.
-
Unfortunately it's not, I could try to make a small example but it will take me some time. I tried to put Session in an Arc Mutex some time ago but I couldn't manage as Session isn't clonable |
Beta Was this translation helpful? Give feedback.
-
Completely understandable 👍
Hmm... As far as I know neither Arc nor Mutex requires the thing to be cloneable? 🤔 (Arc has a |
Beta Was this translation helpful? Give feedback.
-
I checked in Parsec and we open and close sessions just to perform one single operation. I think it's fine to open sessions in parallel but I think that the Login and Logout status of all sessions are affected at the same time |
Beta Was this translation helpful? Give feedback.
-
Hi !
It's more a best practice question than an issue.
I have historical code which I'm updating from rust-pkcs11 to rust-cryptoki.
The usage of cryptoki is to extract certificates and sign some data but also implements the rustls
sign
capacity :What is be the best practice to handle a session here ?
Create a new one just inside this implementation while there is already one active in the function calling rustls ?
Thanks a lot for your feedback 🙏
Beta Was this translation helpful? Give feedback.
All reactions