public override byte[] Encrypt(byte[] data, int offset, int length) { // Calculate signature var bitLength = _key.Modulus.BitLength; var paddedBlock = new byte[bitLength / 8 + (bitLength % 8 > 0 ? 1 : 0) - 1]; paddedBlock[0] = 0x01; for (var i = 1; i < paddedBlock.Length - length - 1; i++) { paddedBlock[i] = 0xFF; } Buffer.BlockCopy(data, offset, paddedBlock, paddedBlock.Length - length, length); return Transform(paddedBlock); }
public void EncryptTest() { RsaKey key = null; // TODO: Initialize to an appropriate value RsaCipher target = new RsaCipher(key); // TODO: Initialize to an appropriate value byte[] data = null; // TODO: Initialize to an appropriate value byte[] expected = null; // TODO: Initialize to an appropriate value byte[] actual; actual = target.Encrypt(data); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }