示例#1
0
        public byte[] handleChallenge(byte[] challenge, IConnectionFactory factory)
        {
            if (factory is ConnectionFactory val)
            {
                return(Encoding.UTF8.GetBytes("\0" + GetUserName(val) + "\0" + AliyunUtils.GetPassword(val.Password)));
            }

            throw new InvalidCastException("Need ConnectionFactory.");
        }
示例#2
0
        private string GetUserName(ConnectionFactory cf)
        {
            string text;

            try
            {
                text = cf.HostName.Split('.')[0];
            }
            catch (Exception)
            {
                throw new InvalidProgramException("HostName invalid.");
            }

            return(AliyunUtils.GetUserName(cf.UserName, text));
        }