-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathLyncParticipant.cs
34 lines (30 loc) · 952 Bytes
/
LyncParticipant.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Microsoft.Lync.Model.Conversation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace BusinessCats
{
public class LyncParticipant
{
public Participant participant;
public InstantMessageModality modality;
public ECDiffieHellmanCng dh;
public byte[] derivedKey;
public byte[] GetPublicKey()
{
if (dh == null)
{
dh = new ECDiffieHellmanCng() { KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash, HashAlgorithm = CngAlgorithm.Sha256 };
}
return dh.PublicKey.ToByteArray();
}
public void DeriveKey(byte[] keyBlob)
{
var otherKey = CngKey.Import(keyBlob, CngKeyBlobFormat.EccPublicBlob);
derivedKey = dh.DeriveKeyMaterial(otherKey);
}
}
}