Exemplo n.º 1
0
 /// <summary>
 /// Generates the Shared Key for this pair (My Secret Key - Your Public Key)
 /// </summary>
 /// <param name="secretKey"></param>
 /// <param name="peerPublicKey"></param>
 internal SharedSecretKey(SecretKey secretKey, PublicKey peerPublicKey)
 {
     KeyValue = AlgorithmService.GetSharedSecretKey(
         privateKey: secretKey.KeyValue,
         peerPublicKey: peerPublicKey.KeyValue);
     Uid = Guid.NewGuid();
 }
 public void GetSharedKeyBobAlice2() => Assert.IsTrue(NaCL_Curve25519TestVectors.AliceBobSharedKey
                                                      .SequenceEqual(AlgorithmService.GetSharedSecretKey(NaCL_Curve25519TestVectors.AlicePublicKey2, NaCL_Curve25519TestVectors.BobPrivateKey)));
 public void GetSharedKeyAliceFrank() => Assert.IsTrue(NaCL_Curve25519TestVectors.AliceFrankSharedKey
                                                       .SequenceEqual(AlgorithmService.GetSharedSecretKey(NaCL_Curve25519TestVectors.FrankPublicKey, NaCL_Curve25519TestVectors.AlicePrivateKey)));