/// <summary>
 /// Constructs an instance of the KeyProvider_SspiClient class.
 /// </summary>
 /// <param name="requiredFeatures">SSPI features that will be provided by the security session.</param>
 /// <param name="packageName">The name of the used SSPI package.</param>
 /// <param name="authIdentity">The authentication identity used during authentication.</param>
 /// <param name="targetName">The name of the server which will be the target of the context. See description of the InitializeSecurityContext function in Platform SDK Security.</param>
 /// <param name="delegatedContext">The context being delegated to the destination host.</param>
 public KeyProvider_SspiClient(SspiFeatureFlags requiredFeatures, SupportedSspiPackages packageName, NetworkCredential authIdentity, string targetName, SecuritySession_SspiServer delegatedContext)
 {
     this.RequiredFeatures = requiredFeatures;
     this.PackageName      = Enum.Format(typeof(SupportedSspiPackages), packageName, "f");
     this.AuthIdentity     = authIdentity;
     this.ServerName       = targetName;
     this.DelegatedContext = delegatedContext;
 }
 /// <summary>
 /// Constructs an instance of the KeyProvider_SspiClient class.
 /// </summary>
 /// <param name="requiredFeatures">SSPI features that will be provided by the security session.</param>
 /// <param name="packageName">The name of the used SSPI package.</param>
 /// <param name="authIdentity">The authentication identity used during authentication.</param>
 /// <param name="targetName">The name of the server which will be the target of the context. See description of the InitializeSecurityContext function in Platform SDK Security.</param>
 /// <param name="delegatedContext">The context being delegated to the destination host.</param>
 public KeyProvider_SspiClient(SspiFeatureFlags requiredFeatures, SupportedSspiPackages packageName, NetworkCredential authIdentity, string targetName, SecuritySession_SspiServer delegatedContext)
 {
     this.RequiredFeatures = requiredFeatures;
     this.PackageName = Enum.Format(typeof(SupportedSspiPackages), packageName, "f");
     this.AuthIdentity = authIdentity;
     this.ServerName = targetName;
     this.DelegatedContext = delegatedContext;
 }
Пример #3
0
        /// <summary>
        /// Creates a Security Session.
        /// </summary>
        /// <param name="name">Security Session name.</param>
        /// <param name="securitySessionType">Security Session type.</param>
        /// <param name="sspiFeatureFlags">Requested features.</param>
        /// <param name="sspiPackage">SSPI package.</param>
        public void CreateSecuritySession(string name, SecuritySessionType securitySessionType,
                                          SspiFeatureFlags sspiFeatureFlags, SupportedSspiPackages sspiPackage)
        {
            IKeyProvider iKeyProvider = null;

            switch (securitySessionType)
            {
            case SecuritySessionType.Basic:
                iKeyProvider = new KeyProvider_Basic();
                break;

            case SecuritySessionType.KnownSymmetric:
                SymmetricAlgorithm symmetricAlgorithm = SymmetricAlgorithm.Create();

                // read the key
                Stream stream = typeof(IEstablishSecuritySession).Assembly.GetManifestResourceStream("Known.written_key");
                byte[] key    = new byte[32];
                stream.Read(key, 0, key.Length);
                stream.Close();

                // initialize the key
                symmetricAlgorithm.Key  = key;
                symmetricAlgorithm.Mode = CipherMode.ECB;

                iKeyProvider = new KeyProvider_KnownSymmetric(symmetricAlgorithm);
                break;

            case SecuritySessionType.SelfEstablishingSymmetric:
                iKeyProvider = new KeyProvider_SelfEstablishingSymmetric();
                break;

            case SecuritySessionType.Sspi:
                iKeyProvider = new KeyProvider_SspiServer(sspiFeatureFlags, sspiPackage);
                break;
            }

            // register the Security Session in the current Transport Context
            GenuineUtility.CurrentMessage.ITransportContext.IKeyStore.SetKey(name, iKeyProvider);
            this._currentSecuritySessionName = name;
        }
 /// <summary>
 /// Constructs an instance of the KeyProvider_SspiServer class.
 /// </summary>
 /// <param name="requiredFeatures">SSPI features that will be provided by Security Sessions.</param>
 /// <param name="packageName">The name of the used SSPI package.</param>
 public KeyProvider_SspiServer(SspiFeatureFlags requiredFeatures, SupportedSspiPackages packageName)
 {
     this.RequiredFeatures = requiredFeatures;
     this.PackageName = Enum.Format(typeof(SupportedSspiPackages), packageName, "f");
 }
 /// <summary>
 /// Constructs an instance of the KeyProvider_SspiClient class.
 /// </summary>
 /// <param name="requiredFeatures">SSPI features that will be provided by the security session.</param>
 /// <param name="packageName">The name of the used SSPI package.</param>
 /// <param name="authIdentity">The authentication identity used during authentication.</param>
 /// <param name="targetName">The name of the server which will be the target of the context. See description of the InitializeSecurityContext function in Platform SDK Security.</param>
 public KeyProvider_SspiClient(SspiFeatureFlags requiredFeatures, SupportedSspiPackages packageName, NetworkCredential authIdentity, string targetName) : this(requiredFeatures, packageName, authIdentity, targetName, null)
 {
 }
Пример #6
0
 /// <summary>
 /// Constructs an instance of the KeyProvider_SspiServer class.
 /// </summary>
 /// <param name="requiredFeatures">SSPI features that will be provided by Security Sessions.</param>
 /// <param name="packageName">The name of the used SSPI package.</param>
 public KeyProvider_SspiServer(SspiFeatureFlags requiredFeatures, SupportedSspiPackages packageName)
 {
     this.RequiredFeatures = requiredFeatures;
     this.PackageName      = Enum.Format(typeof(SupportedSspiPackages), packageName, "f");
 }
 /// <summary>
 /// Constructs an instance of the KeyProvider_SspiClient class.
 /// </summary>
 /// <param name="requiredFeatures">SSPI features that will be provided by the security session.</param>
 /// <param name="packageName">The name of the used SSPI package.</param>
 /// <param name="authIdentity">The authentication identity used during authentication.</param>
 /// <param name="targetName">The name of the server which will be the target of the context. See description of the InitializeSecurityContext function in Platform SDK Security.</param>
 public KeyProvider_SspiClient(SspiFeatureFlags requiredFeatures, SupportedSspiPackages packageName, NetworkCredential authIdentity, string targetName)
     : this(requiredFeatures, packageName, authIdentity, targetName, null)
 {
 }