SharpTox.Encryption.ToxEncryptionFunctions.PassDecrypt C# (CSharp) Method

PassDecrypt() private method

private PassDecrypt ( byte data, uint length, byte passphrase, uint passphraseLength, byte output, ToxErrorDecryption &error ) : bool
data byte
length uint
passphrase byte
passphraseLength uint
output byte
error ToxErrorDecryption
return bool
        internal static extern bool PassDecrypt(byte[] data, uint length, byte[] passphrase, uint passphraseLength, byte[] output, ref ToxErrorDecryption error);

Usage Example

Example #1
0
        public static byte[] DecryptData(byte[] data, string passphrase)
        {
            byte[] output = new byte[data.Length + ToxEncryptionFunctions.PassEncryptionExtraLength()];
            byte[] pp     = Encoding.UTF8.GetBytes(passphrase);
            byte[] result;

            int length = ToxEncryptionFunctions.PassDecrypt(data, (uint)data.Length, pp, (uint)pp.Length, output);

            if (length == -1)
            {
                return(null);
            }

            result = new byte[length];
            Array.Copy(output, 0, result, 0, length);

            return(result);
        }
All Usage Examples Of SharpTox.Encryption.ToxEncryptionFunctions::PassDecrypt