public void PrefetchTest() { Config config = new Config(); config.Zone = Zone.ZONE_CN_East; //config.Region = Region.Region_CN_East; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac, config); HttpResult ret = bucketManager.Prefetch(Bucket, "qiniu.png"); if (ret.Code != (int)HttpCode.OK && !ret.Text.Contains("bucket source not set")) { Assert.Fail("prefetch error: " + ret.ToString()); } Console.WriteLine(ret.ToString()); }
public void ChangeTypeTest() { Config config = new Config(); config.Zone = Zone.ZONE_CN_East; //config.Region = Region.Region_CN_East; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac, config); HttpResult ret = bucketManager.ChangeType(Bucket, "qiniu.png", 1); if (ret.Code != (int)HttpCode.OK && !ret.Text.Contains("already in line stat")) { Assert.Fail("change type error: " + ret.ToString()); } Console.WriteLine(ret.ToString()); }
public void ChangeMimeTest() { Config config = new Config(); config.Zone = Zone.ZONE_CN_East; //config.Region = Region.Region_CN_East; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac, config); HttpResult ret = bucketManager.ChangeMime(Bucket, "qiniu.png", "image/x-png"); if (ret.Code != (int)HttpCode.OK) { Assert.Fail("change mime error: " + ret.ToString()); } Console.WriteLine(ret.ToString()); }
/// <summary> /// 批量操作 /// </summary> public static void batch() { Mac mac = new Mac(Settings.AccessKey, Settings.SecretKey); // 批量操作类似于 // op=<op1>&op=<op2>&op=<op3>... string batchOps = "BATCH_OPS"; BucketManager bm = new BucketManager(mac); HttpResult result = bm.batch(batchOps); // 或者 //string[] batch_ops={"<op1>","<op2>","<op3>",...}; //bm.batch(batch_ops); System.Console.WriteLine(result.Response); }
public void DomainsTest() { Config config = new Config(); config.Zone = Zone.ZONE_CN_East; //config.Region = Region.Region_CN_East; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac, config); DomainsResult ret = bucketManager.Domains(Bucket); if (ret.Code != (int)HttpCode.OK) { Assert.Fail("domains error: " + ret.ToString()); } Console.WriteLine(ret.ToString()); }
public static void downloadFile() { Mac mac = new Mac(Settings.AccessKey, Settings.SecretKey); // 加上过期参数,使用?e=<UnixTimestamp> string rawUrl = "RAW_URL" + "?e=1482207600"; string token = Auth.createDownloadToken(rawUrl, mac); // 生成已授权的链接accUrl,有效期限在?e=时间戳部分 string accUrl = rawUrl + "&token=" + token; // 根据链接访问(下载)文件 // ... System.Console.WriteLine(accUrl); }
/// <summary> /// 缓存刷新 /// </summary> public void CdnRefresh() { // 这个示例单独使用了一个Settings类,其中包含AccessKey和SecretKey // 实际应用中,请自行设置您的AccessKey和SecretKey Mac mac = new Mac(AppCode.AK, AppCode.SK); CdnManager cdnMgr = new CdnManager(mac); string[] dirs = new string[] { "http://omwseoozy.bkt.clouddn.com/" }; var result = cdnMgr.RefreshDirs(dirs); // 或者使用下面的方法 //RefreshRequest request = new RefreshRequest(); //request.AddDirs(dirs); //var result = cdnMgr.RefreshUrlsAndDirs(request); Console.WriteLine(result); }
public void CreateAnitleechUrlTest2() { Mac mac = new Mac(AccessKey, SecretKey); CdnManager target = new CdnManager(mac); string qiniuKey = "12345678"; int expireInSeconds = 600; string host, path, file, query; UrlHelper.UrlSplit(TestURL2, out host, out path, out file, out query); string result = target.CreateTimestampAntiLeechUrl(host, path, file, query, qiniuKey, expireInSeconds); Assert.IsNotNull(result); }
/// <summary> /// getQboxToken /// </summary> /// <returns>void</returns> public void getQboxToken() { // input url string strUrl = ""; //input body JObject jsonBody = new JObject(); string jsonobj = JsonConvert.SerializeObject(jsonBody); byte[] body = Encoding.UTF8.GetBytes(jsonobj); Mac mac = new Mac("", ""); Auth auth = new Auth(mac); string qboxToken = Auth.CreateManageToken(mac, strUrl, body); Console.WriteLine(qboxToken); }
public static Mac GetMac(HashAlgorithm hashAlgorithm) { try { if (hashAlgorithm.needsBouncyCastle) { registerBouncyCastle(); return(Mac.GetInstance(hashAlgorithm.jceHmacId, "BC")); } else { return(Mac.GetInstance(hashAlgorithm.jceHmacId)); } } catch (Exception e) { throw new EncryptedDocumentException("hmac algo not supported", e); } }
/// <summary> /// 删除文件 /// </summary> public HttpResult DelFile(string fileName) { // 空间名 string Bucket = SpaceName; // 文件名 string Key = fileName; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac); HttpResult deleteRet = bucketManager.Delete(Bucket, Key); return(deleteRet); //if (deleteRet.Code != (int)HttpCode.OK) //{ // Console.WriteLine("delete error: " + deleteRet.ToString()); //} }
/// <summary> /// 缓存刷新 /// </summary> public static void cdnRefresh() { Mac mac = new Mac(Settings.AccessKey, Settings.SecretKey); CdnManager fusionMgr = new CdnManager(mac); string[] urls = new string[] { "http://yourdomain.bkt.clouddn.com/somefile.php" }; string[] dirs = new string[] { "http://yourdomain.bkt.clouddn.com/" }; RefreshRequest request = new RefreshRequest(); request.AddUrls(urls); request.AddDirs(dirs); var result = fusionMgr.RefreshUrlsAndDirs(request); Console.WriteLine(result); }
public void Equalのテスト12_34_56_78_9A_BCと比較する(string macStr, bool expected) { //setUp var sut = new Mac("12-34-56-78-9A-BC"); Mac target = null; if (macStr != null) { target = new Mac(macStr); } //exercise bool actual = sut.Equals(target); //verify Assert.That(actual, Is.EqualTo(expected)); }
/// <summary> /// 批量操作 /// </summary> public static void batch() { Mac mac = new Mac(Settings.AccessKey, Settings.SecretKey); // 批量操作类似于 // op=<op1>&op=<op2>&op=<op3>... string batchOps = "op=OP1&op=OP2"; BucketManager bm = new BucketManager(mac); var result = bm.Batch(batchOps); // 或者 //string[] batch_ops={"<op1>","<op2>","<op3>",...}; //bm.Batch(batch_ops); Console.WriteLine(result); }
/// <summary> /// 更新文件的lifecycle /// </summary> public static void updateLifecycle() { Mac mac = new Mac(Settings.AccessKey, Settings.SecretKey); string bucket = "test"; string key = "1.txt"; // 新的deleteAfterDays,设置为0表示取消lifecycle int deleteAfterDays = 1; BucketManager bm = new BucketManager(mac); var result = bm.UpdateLifecycle(bucket, key, deleteAfterDays); Console.WriteLine(result); }
public void CopyTest() { Config config = new Config(); config.Zone = Zone.ZONE_CN_East; Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac, config); string newKey = "qiniu-to-copy.png"; HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true); if (copyRet.Code != (int)HttpCode.OK) { Assert.Fail("copy error: " + copyRet.ToString()); } Console.WriteLine(copyRet.ToString()); }
/// <summary> /// 上传文件到qiniu,返回访问链接 /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static string Upload(string localFile, string saveKey) { // 上传策略 var putPolicy = new PutPolicy(); // 设置要上传的目标空间 putPolicy.Scope = bucket; var mac = new Mac(AK, SK); // 生成上传凭证 var uploadToken = Auth.createUploadToken(putPolicy, mac); // 开始上传文件 var um = new UploadManager(); um.uploadFile(localFile, saveKey, uploadToken, null, null); return(string.Empty); }
public MacIp(Mac mac, Ip ip) { Mac_isPrivate = mac.vendorDetails.isPrivate; Mac_companyName = mac.vendorDetails.companyName; Mac_companyAddress = mac.vendorDetails.companyAddress; Mac_countryCode = mac.vendorDetails.countryCode; Mac_isValid = mac.macAddressDetails.isValid; Mac_searchTerm = mac.macAddressDetails.searchTerm; Ip_ip = ip.ip; Ip_type = ip.type; Ip_country = ip.country; Ip_latitude = ip.latitude; Ip_longitude = ip.longitude; Ip_city = ip.city; }
private void QiniuGui_Load(object sender, EventArgs e) { //获取所有Buckets var appSettings = ConfigurationManager.AppSettings; string AK = appSettings["AK"]; string SK = appSettings["SK"]; mac = new Mac(AK, SK); BucketManager bucketManger = new BucketManager(mac); BucketsResult bucketResult = bucketManger.Buckets(); for (int i = 0; i < bucketResult.Result.Count; i++) { comboBoxBuckets.Items.Add(bucketResult.Result[i]); } }
/** * Example code from http://msdn.microsoft.com/library/azure/dn495627.aspx to * construct a SaS token from the access key to authenticate a request. * * @param uri The unencoded resource URI string for this operation. The resource * URI is the full URI of the Service Bus resource to which access is * claimed. For example, * "http://<namespace>.servicebus.windows.net/<hubName>" */ private static String GenerateSasToken(String uri) { String targetUri; String token = null; try { targetUri = new String(URLEncoder .Encode(uri.ToString().ToLower(), "UTF-8") .ToLower()); long expiresOnDate = JavaSystem.CurrentTimeMillis(); int expiresInMins = 60; // 1 hour expiresOnDate += expiresInMins * 60 * 1000; long expires = expiresOnDate / 1000; String toSign = new String(targetUri + "\n" + expires); // Get an hmac_sha1 key from the raw key bytes byte[] keyBytes = HubSasKeyValue.GetBytes("UTF-8"); SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA256"); // Get an hmac_sha1 Mac instance and initialize with the signing key Mac mac = Mac.GetInstance("HmacSHA256"); mac.Init(signingKey); // Compute the hmac on input data bytes byte[] rawHmac = mac.DoFinal(toSign.GetBytes("UTF-8")); // Using android.util.Base64 for Android Studio instead of // Apache commons codec String signature = new String(URLEncoder.Encode( Base64.EncodeToString(rawHmac, Base64Flags.NoWrap).ToString(), "UTF-8")); // Construct authorization string token = new String("SharedAccessSignature sr=" + targetUri + "&sig=" + signature + "&se=" + expires + "&skn=" + HubSasKeyName); } catch (Exception e) { MainActivity.CurrentActivity.ToastNotify("Exception Generating SaS : " + e.Message.ToString()); //if (isVisible) //{ // ToastNotify("Exception Generating SaS : " + e.getMessage().toString()); //} } return(token); }
/// <summary> /// 文件上传 /// </summary> /// <param name="filepath">文件物理地址</param> public static CloudFile UploadFile(string prefix = "else", string filepath = "") { var model = new CloudFile(); try { // 生成(上传)凭证时需要使用此Mac // 这个示例单独使用了一个Settings类,其中包含AccessKey和SecretKey // 实际应用中,请自行设置您的AccessKey和SecretKey Mac mac = new Mac(Ak, Sk); string saveKey = BasePath + prefix; string localFile = filepath; // 上传策略,参见 // https://developer.qiniu.com/kodo/manual/put-policy PutPolicy putPolicy = new PutPolicy(); // 如果需要设置为"覆盖"上传(如果云端已有同名文件则覆盖),请使用 SCOPE = "BUCKET:KEY" // putPolicy.Scope = bucket + ":" + saveKey; putPolicy.Scope = Bucket; // 上传策略有效期(对应于生成的凭证的有效期) putPolicy.SetExpires(3600); // 上传到云端多少天后自动删除该文件,如果不设置(即保持默认默认)则不删除 //putPolicy.DeleteAfterDays = 1; // 生成上传凭证,参见 // https://developer.qiniu.com/kodo/manual/upload-token string jstr = putPolicy.ToJsonString(); string token = Auth.CreateUploadToken(mac, jstr); //设置上传域名区域 Config config = new Config { Zone = Zone.ZONE_CN_East, UseHttps = true }; UploadManager um = new UploadManager(config); HttpResult result = um.UploadFile(localFile, saveKey, token, null); model.Code = result.Code; if (model.Code != 200) { model.Message = result.Text; } } catch (Exception ex) { model.Code = 500; model.Message = ex.Message; } return(model); }
/// <summary> /// Called whenever a packet is captured on the capture device /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event args</param> private void _onPacketArrival(object sender, CaptureEventArgs e) { // don't process any packet too short to not be valid if (e.Packet.Data.Length < _minimumPacketLength) { return; } // don't process any packets sent by the local device if (_isOutboundPacket(e.Packet.Data)) { return; } byte[] buffer = e.Packet.Data; int offset = 0; Mac destination, source; int length; byte dsap, ssap, control; destination = new Mac(buffer, offset, 6); offset += 6; source = new Mac(buffer, offset, 6); offset += 6; length = buffer.ReadUInt16(offset); offset += 2; dsap = buffer[offset++]; ssap = buffer[offset++]; control = buffer[offset++]; // don't process non-BACnet packets if (dsap != 0x82 || ssap != 0x82 || control != 0x03) { return; } NetgramReceivedMessage message = new NetgramReceivedMessage( this.PortId, source, new BufferSegment(buffer, offset, buffer.Length)); if (Session != null) { Session.QueueMessage(message); } }
private void CreateAuthButton_Click(object sender, RoutedEventArgs e) { long deadline = 0; TimeSpan ts = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1, 0, 0, 0)); if (this.DeadlineTextBox.IsEnabled) { try { deadline = Convert.ToInt64(this.DeadlineTextBox.Text.Trim()); } catch (Exception) { } } else if (this.ExpireTextBox.IsEnabled) { try { long expires = Convert.ToInt64(this.ExpireTextBox.Text.Trim()); deadline = (long)ts.TotalSeconds + expires; } catch (Exception) { } } if (deadline == 0) { deadline = (long)+ts.TotalSeconds + 3600; } string srcUrl = this.SourceUrlTextBox.Text.Trim(); try { Uri uri = new Uri(srcUrl); if (!string.IsNullOrEmpty(uri.Query)) { srcUrl += "&e=" + deadline; } else { srcUrl += "?e=" + deadline; } Mac mac = new Mac(AppSettings.Default.ACCESS_KEY, AppSettings.Default.SECRET_KEY); string token = Qiniu.Util.Auth.CreateDownloadToken(mac, srcUrl); srcUrl += "&token=" + token; this.AuthedUrlTextBox.Text = srcUrl; } catch (Exception) { } }
public static HttpResult UploadFile(Stream filestream, string fileName) { Mac mac = new Mac(_config.AccessKey, _config.SecretKey); PutPolicy putPolicy = new PutPolicy(); putPolicy.Scope = _config.Scope; putPolicy.SetExpires(3600); //putPolicy.DeleteAfterDays = 1; string token = Auth.CreateUploadToken(mac, putPolicy.ToJsonString()); Config config = new Config(); // 设置上传区域 switch (_config.Zone) { case QiniuConfiguration.UploadZone.CN_East: config.Zone = Zone.ZONE_CN_East; break; case QiniuConfiguration.UploadZone.CN_North: config.Zone = Zone.ZONE_CN_North; break; case QiniuConfiguration.UploadZone.CN_South: config.Zone = Zone.ZONE_CN_South; break; case QiniuConfiguration.UploadZone.US_North: config.Zone = Zone.ZONE_US_North; break; } // 设置 http 或者 https 上传 config.UseHttps = true; config.UseCdnDomains = true; config.ChunkSize = ChunkUnit.U512K; ResumableUploader target = new ResumableUploader(config); HttpResult result = target.UploadStream(filestream, fileName, token, null); if (result.Code != (int)HttpCode.OK) { Log.Error(result.Text); throw new Exception(result.Text); } return(result); }
private static readonly string domain = "http://pi2nj2ap1.bkt.clouddn.com"; //融合 CDN 测试域名() public static async Task <KeyValuePair <int, string> > UploadStreamAsync(IFormFile imgFile) { // 生成(上传)凭证时需要使用此Mac // 这个示例单独使用了一个Settings类,其中包含AccessKey和SecretKey // 实际应用中,请自行设置您的AccessKey和SecretKey Mac mac = new Mac(accessKey, secretKey); Qiniu.Common.Config.AutoZone(accessKey, bucket, true); // 上传策略,参见 // https://developer.qiniu.com/kodo/manual/put-policy //用“年/月/日/文件内容md5.文件类型”做文件名 string saveKey = "upload/" + DateTime.Now.ToString("yyyy") + "/" + CommonHelper.GetMD5(imgFile.OpenReadStream()) + Path.GetExtension(imgFile.FileName); PutPolicy putPolicy = new PutPolicy(); // 如果需要设置为"覆盖"上传(如果云端已有同名文件则覆盖),请使用 SCOPE = "BUCKET:KEY" putPolicy.Scope = bucket + ":" + saveKey; //putPolicy.Scope = bucket; // 上传策略有效期(对应于生成的凭证的有效期) putPolicy.SetExpires(3600); // 上传到云端多少天后自动删除该文件,如果不设置(即保持默认默认)则不删除 putPolicy.DeleteAfterDays = 1; // 生成上传凭证,参见 // https://developer.qiniu.com/kodo/manual/upload-token string jstr = putPolicy.ToJsonString(); string token = Auth.CreateUploadToken(mac, jstr); UploadManager um = new UploadManager(); //HttpResult result = um.UploadData(uploadFileBytes, saveKey, token); HttpResult result = await um.UploadStreamAsync(imgFile.OpenReadStream(), saveKey, token); KeyValuePair <int, string> keyValue; if (result.Code == 200) { //domain+"/"+saveKey:http://osvu57cx3.bkt.clouddn.com/upload/2018/63527842B5DBB69BEBF9D86CB110DF6E.jpg keyValue = new KeyValuePair <int, string>(result.Code, domain + "/" + saveKey); return(keyValue); } else { keyValue = new KeyValuePair <int, string>(result.Code, result.Text); return(keyValue); } }
/// <summary> /// 七牛初始化 /// </summary> private void QiniuInit() { var policy = new PutPolicy(); // 上传策略实例 policy.Scope = PresetInfo.bucket; // 设置要上传的目标空间 policy.SetExpires(86400); // 上传策略的过期时间(单位:秒),当前设为24小时 var zoneId = Qiniu.Common.AutoZone.Query(PresetInfo.QiniuAccessKey, PresetInfo.bucket); // 这里的Zone设置(如果不设置,就默认为华东机房) Qiniu.Common.Config.ConfigZone(zoneId); var mac = new Mac(PresetInfo.QiniuAccessKey, PresetInfo.QiniuSecretKey); _uploadToken = Auth.createUploadToken(policy, mac); // 生成上传凭证 // 上传完毕事件处理 _uploadCompleted = new UpCompletionHandler(OnQiniuUploadCompleted); }
public async Task RefreshUrlsAndDirsTest() { string[] urls = { $"http://{Domain}/images/1.png", $"http://{Domain}/images/2.png" }; string[] dirs = { $"http://{Domain}/images1/", $"http://{Domain}/images2/" }; var mac = new Mac(AccessKey, SecretKey); var manager = new CdnManager(mac); var ret = await manager.RefreshUrlsAndDirs(urls, dirs); if (ret.Code != (int)HttpCode.OK) { Assert.True(false, ret.ToString()); } Console.WriteLine(ret.Result.Code); Console.WriteLine(ret.Result.Error); Console.WriteLine(ret.Result.UrlQuotaDay); Console.WriteLine(ret.Result.UrlSurplusDay); Console.WriteLine(ret.Result.DirQuotaDay); Console.WriteLine(ret.Result.DirSurplusDay); Console.WriteLine(ret.Result.RequestId); if (ret.Result.InvalidUrls != null) { foreach (var url in ret.Result.InvalidUrls) { Console.WriteLine(url); } } if (ret.Result.InvalidDirs != null) { foreach (var dir in ret.Result.InvalidDirs) { Console.WriteLine(dir); } } }
/// <summary> /// 获取七牛Token /// </summary> /// <returns></returns> public static Token GetUploadToken() { var mac = new Mac(_settings.QiniuOption.AccessKey, _settings.QiniuOption.SecretKey); var auth = new Auth(mac); var putPolicy = new PutPolicy { Scope = _settings.QiniuOption.Bucketfirst }; // 上传策略有效期(对应于生成的凭证的有效期) putPolicy.SetExpires(3600); // putPolicy.DeleteAfterDays = 1; // 上传到云端多少天后自动删除该文件,如果不设置(即保持默认默认)则不删除 return(new Token { uptoken = auth.CreateUploadToken(putPolicy.ToJsonString()) }); }
/// <summary> /// 上传库文件 /// </summary> /// <returns></returns> private string UploadFile() { try { // 生成(上传)凭证时需要使用此Mac // 这个示例单独使用了一个Settings类,其中包含AccessKey和SecretKey // 实际应用中,请自行设置您的AccessKey和SecretKey Mac mac = new Mac(AppCode.AK, AppCode.SK); string bucket = "mydb"; string saveKey = "Bowtech.db"; string localFile = MapPath; // Server.MapPath("Bowtech.db"); // 上传策略,参见 // https://developer.qiniu.com/kodo/manual/put-policy PutPolicy putPolicy = new PutPolicy(); // 如果需要设置为"覆盖"上传(如果云端已有同名文件则覆盖),请使用 SCOPE = "BUCKET:KEY" putPolicy.Scope = bucket + ":" + saveKey; //putPolicy.Scope = bucket; // 上传策略有效期(对应于生成的凭证的有效期) putPolicy.SetExpires(3600); // 上传到云端多少天后自动删除该文件,如果不设置(即保持默认默认)则不删除 // putPolicy.DeleteAfterDays = 1; string jstr = "{\"scope\":\"" + putPolicy.Scope + "\",\"deadline\":" + putPolicy.Deadline + "}"; //putPolicy.ToJsonString(); string token = Auth.CreateUploadToken(mac, jstr); UploadManager um = new UploadManager(); //先删除 BucketManager bm = new BucketManager(mac); bm.Delete(bucket, saveKey); HttpResult result = um.UploadFile(localFile, saveKey, token); string res = result.ToString(); if (res.Substring(0, 8) == "code:200") { return("上传完成"); } else { return("上传异常"); } } catch (Exception ep) { return(ep.Message); } }
public VideoService(IRepository <Video> videoRepository, IRepository <ProductVideo> productVideoRepository, IDbContext dbContext, ISettingService settingService, IWebHelper webHelper, IEventPublisher eventPublisher ) { this._videoRepository = videoRepository; this._productVideoRepository = productVideoRepository; this._dbContext = dbContext; this._settingService = settingService; this._webHelper = webHelper; this._eventPublisher = eventPublisher; mac = new Mac(ak, sk); }
/// <summary> /// 生成上传Token /// </summary> /// <returns></returns> public string Token (Mac mac=null) { if (string.IsNullOrEmpty (persistentOps) ^ string.IsNullOrEmpty (persistentNotifyUrl)) { throw new Exception ("PersistentOps and PersistentNotifyUrl error"); } if (string.IsNullOrEmpty (callBackUrl) ^ string.IsNullOrEmpty (callBackBody)) { throw new Exception ("CallBackUrl and CallBackBody error"); } if (!string.IsNullOrEmpty (returnUrl) && !string.IsNullOrEmpty (callBackUrl)) { throw new Exception ("returnUrl and callBackUrl error"); } if (mac == null) { mac = new Mac (Config.ACCESS_KEY, Config.Encoding.GetBytes (Config.SECRET_KEY)); } this.deadline = (UInt32)((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 + (long)expires); string flag = this.ToString (); return mac.SignWithData (Config.Encoding.GetBytes (flag)); }
public QiniuAuthClient (Mac mac = null) { this.mac = mac == null ? new Mac () : mac; }
public RSClient(Mac mac=null) : base(mac) { }
/// <summary> /// 生成上传Token /// </summary> /// <returns></returns> public string Token(Mac mac=null) { if (mac == null) { mac = new Mac (Config.ACCESS_KEY, Config.Encoding.GetBytes (Config.SECRET_KEY)); } string flag = QiniuJsonHelper.JsonEncode (this); return mac.SignWithData (Config.Encoding.GetBytes (flag)); }