private DeriveKeyWithSalt ( byte passphrase, uint passphraseLength, byte salt, |
||
passphrase | byte | |
passphraseLength | uint | |
salt | byte | |
outputKey | ||
error | ToxErrorKeyDerivation | |
리턴 | bool |
internal static ToxPassKey? DeriveKey(string passphrase, byte[] salt) { if (salt.Length < SaltLength) return null; byte[] pp = Encoding.UTF8.GetBytes(passphrase); var error = ToxErrorKeyDerivation.Ok; var key = new ToxPassKey(); if (!ToxEncryptionFunctions.DeriveKeyWithSalt(pp, (uint)pp.Length, salt, ref key, ref error) || error != ToxErrorKeyDerivation.Ok) return null; return key; }
public static byte[] DeriveKey(string passphrase, byte[] salt) { if (salt.Length < ToxEncryptionFunctions.PassSaltLength()) { return(null); } byte[] pp = Encoding.UTF8.GetBytes(passphrase); byte[] key = new byte[ToxEncryptionFunctions.PassKeyLength()]; if (ToxEncryptionFunctions.DeriveKeyWithSalt(pp, (uint)pp.Length, salt, key) == -1) { return(null); } return(key); }