【问题标题】:DocuSign Webhooks Connect key integrationDocuSign Webhooks Connect 密钥集成
【发布时间】:2020-05-28 06:44:34
【问题描述】:

我们正在使用 DocuSign rest api 创建和发送 DocuSign 信封。我们将事件通知附加到它,并在 Webhooks 中获取与信封状态相关的信息。我们使用 SOAP 接口(SOAP 方法:DocuSignConnectUpdate)。我们希望在从 DocuSign 收到的 webhook 上实施 HMAC 安全性。

我在我们的演示帐户上创建了自定义连接配置以进行测试,但不确定如何在 Webhooks 侦听器上实现它。我在更改设置后得到的 Webhook 中仍然没有 HMAC 标头。

你能告诉我们如何实现它吗?

我们的 Webhooks 监听器是使用 c# 开发的

谢谢, 迪桑特

【问题讨论】:

    标签: c# docusignapi webhooks


    【解决方案1】:

    DocuSign 开发人员中心上的这个guide 包含有关使用 HMAC 保护您的 webhook 调用的信息。

    这是向您展示如何验证 HMAC 的 C# sn-p:

    public static class HMAC
    {
        public static string ComputeHash(string secret, string payload)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(secret);
            System.Security.Cryptography.HMAC hmac = new System.Security.Cryptography.HMACSHA256(bytes);
            bytes = Encoding.UTF8.GetBytes(payload);
            bytes = hmac.ComputeHash(bytes);
            return Convert.ToBase64String(bytes);
        }
    
        public static bool HashIsValid(string secret, string payload, string verify)
        {
            return ComputeHash(secret, payload).Equals(verify);
        }
    }
    

    【讨论】:

    • 谢谢,上面的代码将去哪里以及我们将从哪里调用它?我找到了这个页面,但不确定我们是否正确配置以将 HMAC 安全附加到 DocuSign Webhooks
    • 您将此代码放在处理来自 DocuSign 的 webhook 请求(连接)的网络服务器上。它必须响应您在连接配置中使用的 URL。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多