private static ToxEncryptionKeyHandle Derive(string passphrase, out ToxErrorKeyDerivation error) { // warning (no salt means one gets pseudo-random generated) ? byte[] binaryPassphrase = ToxConstants.Encoding.GetBytes(passphrase); error = ToxErrorKeyDerivation.Ok; return(ToxEncryptionFunctions.Key.Derive(binaryPassphrase, (uint)binaryPassphrase.Length, ref error)); }
private static ToxEncryptionKeyHandle Derive(string passphrase, byte[] salt, out ToxErrorKeyDerivation error) { if (salt.Length != ToxEncryptionConstants.SaltLength) { throw new ArgumentException(nameof(salt)); } byte[] binaryPassphrase = ToxConstants.Encoding.GetBytes(passphrase); error = ToxErrorKeyDerivation.Ok; return(ToxEncryptionFunctions.Key.DeriveWithSalt(binaryPassphrase, (uint)binaryPassphrase.Length, salt, ref error)); }
internal static extern bool DeriveKeyWithSalt(byte[] passphrase, uint passphraseLength, byte[] salt, ref ToxPassKey outputKey, ref ToxErrorKeyDerivation error);
internal static extern bool DeriveKeyFromPass(byte[] passphrase, uint passphraseLength, ref ToxPassKey outputKey, ref ToxErrorKeyDerivation error);
public static extern ToxEncryptionKeyHandle DeriveWithSalt(Byte[] passphrase, SizeT length, Byte[] salt, ref ToxErrorKeyDerivation error);