public event Action <SecureContext> SecureConnectionRequired; //跨线程事件(订阅者需要保证线程安全) public void RaiseSecureConnectionRequired(SecureContext c) { if (SecureConnectionRequired != null) { SecureConnectionRequired(c); } IsSecureConnection = true; }
public void SetSecureContext(SecureContext SecureContext) { WillUseEncryption = true; ServerStream = new RC4(SecureContext.ServerToken); ClientStream = new RC4(SecureContext.ClientToken); ServerStream.Skip(1536); ClientStream.Skip(1536); }