1

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?

N. McA.
  • 4,796
  • 4
  • 35
  • 60
  • You post code, but does that have anything to do with the question you are asking? What code causes the error? – Nick Hodges Jun 08 '12 at 20:16
  • I can post that code, which is just a standard lockbox rsa encryption setup, but it is identical to a functional piece with a different key from elsewhere in the project, so I'm pretty sure the problem isn't there. – N. McA. Jun 08 '12 at 20:45

1 Answers1

4

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490