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); }
internal static extern bool DeriveKeyWithSalt(byte[] passphrase, uint passphraseLength, byte[] salt, ref ToxPassKey outputKey, ref ToxErrorKeyDerivation error);
internal static extern bool PassKeyDecrypt(byte[] data, uint length, ref ToxPassKey key, byte[] output, ref ToxErrorDecryption error);
internal static extern bool DeriveKeyFromPass(byte[] passphrase, uint passphraseLength, ref ToxPassKey outputKey, ref ToxErrorKeyDerivation error);