Beispiel #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;
        }
Beispiel #2
0
        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;
        }
 internal static extern bool PassKeyEncrypt(byte[] data, uint dataLength, ref ToxPassKey key, byte[] output, ref ToxErrorEncryption 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);
 internal static extern bool PassKeyDecrypt(byte[] data, uint length, ref ToxPassKey key, byte[] output, ref ToxErrorDecryption 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);
Beispiel #9
0
        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;
        }
Beispiel #10
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;
        }