コード例 #1
0
ファイル: KeyProvider.cs プロジェクト: viruswevh/ObscurCore
 static KeyProviders()
 {
     Alice = new KeyProvider();
     Bob   = new KeyProvider(Alice);
     // Assign each other's public keys as foreign key sources
     Alice.ForeignEcKeys = Bob.EcKeypairs.Select(keypair => keypair.ExportPublicKey());
     Bob.ForeignEcKeys   = Alice.EcKeypairs.Select(keypair => keypair.ExportPublicKey());
 }
コード例 #2
0
ファイル: KeyProvider.cs プロジェクト: viruswevh/ObscurCore
 /// <summary>
 ///     Create a key provider with keys based off an existing key provider,
 ///     aimed at a sender-recipient relationship.
 /// </summary>
 /// <param name="other">Existing key provider to use as a basis for interoperability.</param>
 public KeyProvider(KeyProvider other)
 {
     SymmetricKeys = other.SymmetricKeys.Reverse().ToList();
     EcKeypairs    = other.EcKeypairs.Select(
         item => {
         ECKeypair newEcKeypair = KeypairFactory.GenerateECKeypair(item.CurveName);
         var newEcCanary        = new byte[128.BitsToBytes()];
         StratCom.EntropySupplier.NextBytes(newEcCanary);
         newEcKeypair.ConfirmationCanary = newEcCanary;
         return(newEcKeypair);
     }).ToList();
 }