Tempest.RSACrypto.Encrypt C# (CSharp) Method

Encrypt() public method

public Encrypt ( byte data ) : byte[]
data byte
return byte[]
        public byte[] Encrypt(byte[] data)
        {
            if (data == null)
                throw new ArgumentNullException ("data");

            return this.rsaCrypto.Encrypt (data, true);
        }

Usage Example

        public void Serialize(IValueWriter writer, RSACrypto crypto)
        {
            if (!writer.WriteBool (this.publicKey != null))
                return;

            writer.WriteBytes (crypto.Encrypt (this.Exponent));

            int first = this.Modulus.Length / 2;
            writer.WriteBytes (crypto.Encrypt (this.Modulus.Copy (0, first)));
            writer.WriteBytes (crypto.Encrypt (this.Modulus.Copy (first, this.Modulus.Length - first)));
        }