Search code examples
delphiencryptionlockbox-3

LockBox Stream read error, RSA


I'm loading a RSA key from a stream and getting an "Stream Read" error? What's the first thing I should try to get my code working?


Solution

  • Bit of a wild guess, but this can happen if the stream's position is not reset to 0 when you try to read from the stream, after having written to it. Try setting

    SigStore.Position := 0;
    

    immediately before using the stream to encrypt.