GetUserSessionKey() публичный Метод

Returns the effective user session key.
Returns the effective user session key.
public GetUserSessionKey ( byte challenge ) : byte[]
challenge byte The server challenge.
Результат byte[]
Пример #1
0
        /// <exception cref="SharpCifs.Smb.SmbException"></exception>
        public SigningDigest(SmbTransport transport, NtlmPasswordAuthentication auth)
        {
            try
            {
                _digest = MessageDigest.GetInstance("MD5");
            }
            catch (NoSuchAlgorithmException ex)
            {
                if (Log.Level > 0)
                {
                    Runtime.PrintStackTrace(ex, Log);
                }
                throw new SmbException("MD5", ex);
            }
            try
            {
                switch (SmbConstants.LmCompatibility)
                {
                case 0:
                case 1:
                case 2:
                {
                    _macSigningKey = new byte[40];
                    auth.GetUserSessionKey(transport.Server.EncryptionKey, _macSigningKey, 0);
                    Array.Copy(auth.GetUnicodeHash(transport.Server.EncryptionKey), 0, _macSigningKey
                               , 16, 24);
                    break;
                }

                case 3:
                case 4:
                case 5:
                {
                    _macSigningKey = new byte[16];
                    auth.GetUserSessionKey(transport.Server.EncryptionKey, _macSigningKey, 0);
                    break;
                }

                default:
                {
                    _macSigningKey = new byte[40];
                    auth.GetUserSessionKey(transport.Server.EncryptionKey, _macSigningKey, 0);
                    Array.Copy(auth.GetUnicodeHash(transport.Server.EncryptionKey), 0, _macSigningKey
                               , 16, 24);
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                throw new SmbException(string.Empty, ex);
            }
            if (Log.Level >= 5)
            {
                Log.WriteLine("LM_COMPATIBILITY=" + SmbConstants.LmCompatibility);
                Hexdump.ToHexdump(Log, _macSigningKey, 0, _macSigningKey.Length);
            }
        }
Пример #2
0
		/// <exception cref="SharpCifs.Smb.SmbException"></exception>
		public SigningDigest(SmbTransport transport, NtlmPasswordAuthentication auth)
		{
			try
			{
				_digest = MessageDigest.GetInstance("MD5");
			}
			catch (NoSuchAlgorithmException ex)
			{
				if (Log.Level > 0)
				{
					Runtime.PrintStackTrace(ex, Log);
				}
				throw new SmbException("MD5", ex);
			}
			try
			{
                switch (SmbConstants.LmCompatibility)
				{
					case 0:
					case 1:
					case 2:
					{
						_macSigningKey = new byte[40];
						auth.GetUserSessionKey(transport.Server.EncryptionKey, _macSigningKey, 0);
						Array.Copy(auth.GetUnicodeHash(transport.Server.EncryptionKey), 0, _macSigningKey
							, 16, 24);
						break;
					}

					case 3:
					case 4:
					case 5:
					{
						_macSigningKey = new byte[16];
						auth.GetUserSessionKey(transport.Server.EncryptionKey, _macSigningKey, 0);
						break;
					}

					default:
					{
						_macSigningKey = new byte[40];
						auth.GetUserSessionKey(transport.Server.EncryptionKey, _macSigningKey, 0);
						Array.Copy(auth.GetUnicodeHash(transport.Server.EncryptionKey), 0, _macSigningKey
							, 16, 24);
					    break;
					}
				}
			}
			catch (Exception ex)
			{
				throw new SmbException(string.Empty, ex);
			}
			if (Log.Level >= 5)
			{
                Log.WriteLine("LM_COMPATIBILITY=" + SmbConstants.LmCompatibility);
				Hexdump.ToHexdump(Log, _macSigningKey, 0, _macSigningKey.Length);
			}
		}