KeyChain::sign is slow with tpm=osx-keychain
Environment: OSX 10.9 on Mac Mini
Steps to reproduce:
- install a self-signed default certificate
- prepare one Data packet with 4096 octet payload
keyChain.sign(data)in a loop of 1000 times, and observe time spent in the loop
Expected: signing 1000 packets takes less than 5 seconds
Actual: signing 1000 packets takes more than 15 seconds
Updated by Alex Afanasyev over 7 years ago
This is a known issue and I would like to reject this.
For security to be secure, private key should never be exposed to the application, not mentioning be cached in memory. This basically defeats the purpose of security and key protection in the first place (there are well-known "cold boot" attacks, where keys are being extracted from RAM). And as long the key is secured, there is obviously large overhead and we would see extremely slow performance, such the one with OSX keychain.
Separate issue #1204 should address signing performance problem, without sacrificing much of security benefits by clearly separating keys that are used by applications and user keys that can be used to sign application keys. The former keys can be "less secure" (as they are cheap), kept, and used directly from RAM.
Updated by Jeff Burke over 7 years ago
I agree with the fix proposed in #1204. This issue may block low-latency / high-throughput applications from using signing in the current security library. Can its priority be increased and example code be provided for how applications should generate derived keys?