示例#1
0
        public GSTNResult <OTPResponseModel> RequestOTP()
        {
            OTPRequestModel model = new OTPRequestModel {
                action   = "OTPREQUEST",
                username = userid,
                app_key  = EncryptionUtils.RsaEncrypt(GSTNConstants.GetAppKeyBytes())
            };
            var output = this.Post <OTPRequestModel, OTPResponseModel>(model);

            return(output);
        }
示例#2
0
        public GSTNResult <TokenResponseModel> RequestToken(string otp)
        {
            TokenRequestModel model = new TokenRequestModel {
                action   = "AUTHTOKEN",
                username = userid
            };

            model.app_key = EncryptionUtils.RsaEncrypt(GSTNConstants.GetAppKeyBytes());
            byte[] dataToEncrypt = UTF8Encoding.UTF8.GetBytes(otp);
            model.otp = EncryptionUtils.AesEncrypt(dataToEncrypt, GSTNConstants.GetAppKeyBytes());
            var output = this.Post <TokenRequestModel, TokenResponseModel>(model);

            this.userid       = userid;
            token             = output.Data;
            this.AuthToken    = token.auth_token;
            this.DecryptedKey = EncryptionUtils.AesDecrypt(token.sek, GSTNConstants.GetAppKeyBytes());
            var Decipher = System.Text.Encoding.UTF8.GetString(DecryptedKey);

            return(output);
        }