public void TestVector1() { var retval = kdf.DeriveKey(new byte[] { }, new byte[] { }, 16, 1, 1, 64); Assert.That(retval, Is.EqualTo(new byte[] { 0x77, 0xd6, 0x57, 0x62, 0x38, 0x65, 0x7b, 0x20, 0x3b, 0x19, 0xca, 0x42, 0xc1, 0x8a, 0x04, 0x97, 0xf1, 0x6b, 0x48, 0x44, 0xe3, 0x07, 0x4a, 0xe8, 0xdf, 0xdf, 0xfa, 0x3f, 0xed, 0xe2, 0x14, 0x42, 0xfc, 0xd0, 0x06, 0x9d, 0xed, 0x09, 0x48, 0xf8, 0x32, 0x6a, 0x75, 0x3a, 0x0f, 0xc8, 0x1f, 0x17, 0xe8, 0xd3, 0xe0, 0xfb, 0x2e, 0x0d, 0x36, 0x28, 0xcf, 0x35, 0xe2, 0x0c, 0x38, 0xd1, 0x89, 0x06, })); }
public bool TryRatchet(out byte[] NewPrivateKey) { try { privateKey = kdf.DeriveKey(privateKey); NewPrivateKey = PrivateKey; return(true); } catch (CryptographicException e) { logger.LogError("Failed to ratchet DiffieHellman, {Error}", e); NewPrivateKey = default; return(false); } }
public byte[] DeriveKey(byte[] password, byte[] salt, ulong N, uint r, uint p, uint derivedKeyLengthBytes) { HookupAssemblyLoader(); EnsureCrtInitialized(); return(nativeKeyDerivationFunction.DeriveKey(password, salt, N, r, p, derivedKeyLengthBytes)); }
public byte[] DeriveKey(byte[] password, byte[] salt, ulong N, uint r, uint p, uint derivedKeyLengthBytes) { return(kdf.DeriveKey(password, salt, N, r, p, derivedKeyLengthBytes)); }