byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("AAAAAAAAAAAAA");
TextReader trCer = new StreamReader(@"AA.key"); //key in PEM format
PemReader rdCer = new PemReader(trCer);
AsymmetricCipherKeyPair o = rdCer.ReadObject() as AsymmetricCipherKeyPair;
ISigner sig = SignerUtilities.GetSigner("MD5WithRSAEncryption");
sig.Init(true, o.Private);
sig.BlockUpdate(plaintext,0,plaintext.Length);
Byte[] signature = sig.GenerateSignature();
string signatureHeader = Convert.ToBase64String(signature);
Console.WriteLine(signatureHeader);
Как использовать ключ в формате DER?Я использую библиотеку BouncyCastle.Crypto.dll
`