示例#1
0
 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));
 }
示例#2
0
        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));
        }
示例#3
0
 internal static extern bool DeriveKeyWithSalt(byte[] passphrase, uint passphraseLength, byte[] salt, ref ToxPassKey outputKey, ref ToxErrorKeyDerivation error);
示例#4
0
 internal static extern bool DeriveKeyFromPass(byte[] passphrase, uint passphraseLength, ref ToxPassKey outputKey, ref ToxErrorKeyDerivation 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);
示例#7
0
 public static extern ToxEncryptionKeyHandle DeriveWithSalt(Byte[] passphrase, SizeT length, Byte[] salt, ref ToxErrorKeyDerivation error);