private void DoUpdate(byte[] input, byte[] output, bool do_final) { Buffer.BlockCopy(input, 0, output, 0, (int)_key_size); int crypted_size = (int)_key_size; bool result = Crypt32.CryptEncrypt(_key, IntPtr.Zero, do_final, 0, ref output, ref crypted_size, (int)_key_size); }
internal byte[] public_encrypt(byte[] input, bool do_final) { byte[] output = new byte[_key_size]; Buffer.BlockCopy(input, 0, output, 0, input.Length); int dword_input_size = input.Length; bool result = Crypt32.CryptEncrypt(_key, IntPtr.Zero, do_final, Crypt32.CRYPT_OAEP, ref output, ref dword_input_size, _key_size); for (int i = 0; i < (_key_size / 2); i++) { byte c = output[i]; output[i] = output[_key_size - 1 - i]; output[_key_size - 1 - i] = c; } Helpers.Resize(ref output, dword_input_size); // is this necessary? return(output); }