You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
2 months ago
|
/*
|
||
|
* Copyright (C) Alibaba Cloud Computing
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* 版权所有 (C)阿里云计算有限公司
|
||
|
*/
|
||
|
|
||
|
using System;
|
||
|
|
||
|
namespace Aliyun.Api.LOG.Common.Authentication
|
||
|
{
|
||
|
internal abstract class ServiceSignature
|
||
|
{
|
||
|
public abstract string SignatureMethod { get; }
|
||
|
|
||
|
public abstract string SignatureVersion { get; }
|
||
|
|
||
|
protected ServiceSignature()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public string ComputeSignature(String key, String data)
|
||
|
{
|
||
|
if (string.IsNullOrEmpty(key))
|
||
|
throw new ArgumentException(Aliyun.Api.LOG.Properties.Resources.ExceptionIfArgumentStringIsNullOrEmpty, "key");
|
||
|
if (string.IsNullOrEmpty(data))
|
||
|
throw new ArgumentException(Aliyun.Api.LOG.Properties.Resources.ExceptionIfArgumentStringIsNullOrEmpty, "data");
|
||
|
|
||
|
return ComputeSignatureCore(key, data);
|
||
|
}
|
||
|
|
||
|
protected abstract string ComputeSignatureCore(string key, string data);
|
||
|
|
||
|
public static ServiceSignature Create()
|
||
|
{
|
||
|
return new HmacSHA1Signature();
|
||
|
}
|
||
|
}
|
||
|
}
|