/**
* What we get back from the signer are the two components of a signature, r and s. To get a flat byte stream
* of the type used by Bitcoin we have to encode them using DER encoding, which is just a way to pack the two
* components into a structure.
*/
public byte[] ToDER()
{
// Usually 70-72 bytes.
MemoryStream bos = new MemoryStream(72);
DerSequenceGenerator seq = new DerSequenceGenerator(bos);
seq.AddObject(new DerInteger(R));
seq.AddObject(new DerInteger(S));
seq.Close();
return bos.ToArray();
}