Decrypt() public method

public Decrypt ( byte data ) : byte[]
data byte
return byte[]
Beispiel #1
0
        public void Deserialize(IValueReader reader, RSACrypto crypto)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (crypto == null)
            {
                throw new ArgumentNullException("crypto");
            }

            if (reader.ReadBool())
            {
                byte[] exponent = crypto.Decrypt(reader.ReadBytes());

                byte[] modulus1 = crypto.Decrypt(reader.ReadBytes());
                byte[] modulus2 = crypto.Decrypt(reader.ReadBytes());
                byte[] modulus  = modulus1.Concat(modulus2).ToArray();

                this.exponentOffset = modulus.Length;
                this.publicKey      = new byte[exponent.Length + modulus.Length];
                Buffer.BlockCopy(modulus, 0, this.publicKey, 0, modulus.Length);
                Buffer.BlockCopy(exponent, 0, this.publicKey, exponentOffset, exponent.Length);
            }

            SetupSignature();
        }
        public void Deserialize(IValueReader reader, RSACrypto crypto)
        {
            if (reader == null)
                throw new ArgumentNullException ("reader");
            if (crypto == null)
                throw new ArgumentNullException ("crypto");

            if (reader.ReadBool())
            {
                byte[] exponent = crypto.Decrypt (reader.ReadBytes());

                byte[] modulus1 = crypto.Decrypt (reader.ReadBytes());
                byte[] modulus2 = crypto.Decrypt (reader.ReadBytes());
                byte[] modulus = modulus1.Concat (modulus2).ToArray();

                this.exponentOffset = modulus.Length;
                this.publicKey = new byte[exponent.Length + modulus.Length];
                Buffer.BlockCopy (modulus, 0, this.publicKey, 0, modulus.Length);
                Buffer.BlockCopy (exponent, 0, this.publicKey, exponentOffset, exponent.Length);
            }

            SetupSignature();
        }