public BitChatService(BitChatProfile profile, Certificate[] trustedRootCertificates, SecureChannelCryptoOptionFlags supportedCryptoOptions, InvalidCertificateEvent invalidCertEventHandler) { //verify root certs foreach (Certificate trustedCert in trustedRootCertificates) trustedCert.Verify(trustedRootCertificates); //verify profile cert profile.LocalCertificateStore.Certificate.Verify(trustedRootCertificates); _invalidCertEventHandler = invalidCertEventHandler; _manager = new InternalBitChatService(this, profile, trustedRootCertificates, supportedCryptoOptions); foreach (BitChatProfile.BitChatInfo bitChatInfo in profile.BitChatInfoList) { if (bitChatInfo.Type == BitChatNetworkType.PrivateChat) _bitChats.Add(_manager.CreateBitChat(new MailAddress(bitChatInfo.NetworkNameOrPeerEmailAddress), bitChatInfo.SharedSecret, bitChatInfo.NetworkID, bitChatInfo.PeerCertificateList, bitChatInfo.SharedFileList, bitChatInfo.TrackerURIs)); else _bitChats.Add(_manager.CreateBitChat(bitChatInfo.NetworkNameOrPeerEmailAddress, bitChatInfo.SharedSecret, bitChatInfo.NetworkID, bitChatInfo.PeerCertificateList, bitChatInfo.SharedFileList, bitChatInfo.TrackerURIs)); } //check profile cert revocation ThreadPool.QueueUserWorkItem(CheckCertificateRevocationAsync, new Certificate[] { profile.LocalCertificateStore.Certificate }); //check trusted root cert revocation ThreadPool.QueueUserWorkItem(CheckCertificateRevocationAsync, trustedRootCertificates); }
public BitChatService(BitChatProfile profile, Certificate[] trustedRootCertificates, SecureChannelCryptoOptionFlags supportedCryptoOptions, InvalidCertificateEvent invalidCertEventHandler) { //verify root certs foreach (Certificate trustedCert in trustedRootCertificates) { trustedCert.Verify(trustedRootCertificates); } //verify profile cert profile.LocalCertificateStore.Certificate.Verify(trustedRootCertificates); _invalidCertEventHandler = invalidCertEventHandler; _manager = new InternalBitChatService(this, profile, trustedRootCertificates, supportedCryptoOptions); foreach (BitChatProfile.BitChatInfo bitChatInfo in profile.BitChatInfoList) { if (bitChatInfo.Type == BitChatNetworkType.PrivateChat) { _bitChats.Add(_manager.CreateBitChat(new MailAddress(bitChatInfo.NetworkNameOrPeerEmailAddress), bitChatInfo.SharedSecret, bitChatInfo.NetworkID, bitChatInfo.PeerCertificateList, bitChatInfo.SharedFileList, bitChatInfo.TrackerURIs)); } else { _bitChats.Add(_manager.CreateBitChat(bitChatInfo.NetworkNameOrPeerEmailAddress, bitChatInfo.SharedSecret, bitChatInfo.NetworkID, bitChatInfo.PeerCertificateList, bitChatInfo.SharedFileList, bitChatInfo.TrackerURIs)); } } //check profile cert revocation ThreadPool.QueueUserWorkItem(CheckCertificateRevocationAsync, new Certificate[] { profile.LocalCertificateStore.Certificate }); //check trusted root cert revocation ThreadPool.QueueUserWorkItem(CheckCertificateRevocationAsync, trustedRootCertificates); }