aws / aws-nitro-enclaves-nsm-api

This provides a library for interacting with the Nitro Secure Module, which provides Nitro Enclaves with attestation capability.
Apache License 2.0
62 stars 43 forks source link

Cryptographically secure RNG for python libraries #10

Closed Jonas-Metzger closed 3 years ago

Jonas-Metzger commented 3 years ago

Hi, I want to use python libraries like urllib.request and ecdsa from inside the enclave. Ultimately, their cryptographic security ultimately relies on library calls like ssl.RAND_bytes() and random.SystemRandom() to return cryptographically secure random numbers.

When I start the same .eif twice in a row, I see that ssl.RAND_bytes() returns different values. But I also read somewhere that "there's no randomness" in Nitro enclaves, and that for security reasons, I should use the RNG implemented in this library. I'm assuming the latter is correct, so I'm wondering what would be the easiest way to use the Nitro RNG provided by this library to make libraries like ssl act securely.

Is it possible to call the Nitro RNG only once in the beginning, and inject entropy "system-wide", such that any library that relies on a pseudo-RNG that's cryptographically secure on a regular machine, would also be inside a nitro enclave?