DeriveKeyFromPass() private method

private DeriveKeyFromPass ( byte passphrase, uint passphraseLength, ToxPassKey &outputKey, ToxErrorKeyDerivation &error ) : bool
passphrase byte
passphraseLength uint
outputKey ToxPassKey
error ToxErrorKeyDerivation
return bool
示例#1
0
        internal static ToxPassKey? DeriveKey(string passphrase)
        {
            byte[] pp = Encoding.UTF8.GetBytes(passphrase);
            var error = ToxErrorKeyDerivation.Ok;
            var key = new ToxPassKey();

            if (!ToxEncryptionFunctions.DeriveKeyFromPass(pp, (uint)pp.Length, ref key, ref error) || error != ToxErrorKeyDerivation.Ok)
                return null;

            return key;
        }
示例#2
0
        public static byte[] DeriveKey(string passphrase)
        {
            byte[] pp  = Encoding.UTF8.GetBytes(passphrase);
            byte[] key = new byte[ToxEncryptionFunctions.PassKeyLength()];

            if (ToxEncryptionFunctions.DeriveKeyFromPass(pp, (uint)pp.Length, key) == -1)
            {
                return(null);
            }

            return(key);
        }