public void NoOneTimeKey() { PrivateKey ika = PrivateKey.Create(); PrivateKey eka = PrivateKey.Create(); PrivateKey ikb = PrivateKey.Create(); KeyBundle bob = new KeyBundle { IdentityKey = ikb.ToPublicKey(), Prekey = SignedKey.Create(), }; ICryptoMethods crypto = new EdDSAMethods(); byte[] dh1 = crypto.KeyExchange(ika, bob.Prekey); byte[] dh2 = crypto.KeyExchange(bob.IdentityKey, eka); byte[] dh3 = crypto.KeyExchange(eka, bob.Prekey); byte[] sk = crypto.DeriveKey(dh1.Concat(dh2, dh3)); //eka = default;//alice deletes this, bob needs it below dh1 = dh2 = dh3 = default; byte[] ad = ika.PublicKeyBytes.Concat(bob.IdentityKey.PublicKeyBytes); //TODO: this is recommended to have a more standardized format (byte[] ciphertext, byte[] nonce) = crypto.Encrypt(ad, sk); //output is sent to bob KeyBundleResponse response = new KeyBundleResponse { Ciphertext = ciphertext, EphemeralKey = eka, PrekeyHash = default,//TODO:
public void SignedKey_Validates() { PrivateKey privKey = PrivateKey.Create(); new SignedKey(privKey.PrivateKeyBytes, new EdDSAMethods()).IsValidSignature.Should().BeTrue(); }