Azure WebJob 队列触发器不响应加密的队列消息
Azure WebJob Queue Trigger not responding to encrypted queue message
我需要对写入 Azure 存储的所有消息进行加密。
我想使用 Azure 队列来触发 WebJobs,所以在存储之前采用了下面的这种方法来加密队列消息:
https://docs.microsoft.com/en-us/azure/storage/storage-client-side-encryption
这可以很好地加密队列中的消息。
然后我想写一个 WebJob(或者更好的是,一个 Azure Function)来响应 Queue 消息并对其进行解密和处理。
不幸的是,网络作业总是因异常而失败
System.FormatException: The input is not a valid Base-64 string as it
contains a non-base 64
character, more than two padding characters, or an illegal character among
the padding characters
有没有人有办法做到这一点。我什至尝试像示例中那样实现自己的 CustomQueueProcessFactory
但 Azure WebJob 库仅使用 CloudQueueMessage 调用它,而我需要在此之前对其进行加密。
有什么想法吗?
谢谢。
我相信您可以使用 CustomQueueProcessor
通过修改创建方法中的服务客户端选项来完成此操作。
public QueueProcessor Create(QueueProcessorFactoryContext context)
{
...
// demonstrates how the Queue.ServiceClient options can be configured
context.Queue.ServiceClient.DefaultRequestOptions.EncryptionPolicy = policy;
...
}
不幸的是,我们没有在 Azure Function 中提供那种级别的控制(如果您将函数运行时部署为应用服务计划中的站点扩展,您可以破解它,但您不会获得任何消费扩展等)。
我需要对写入 Azure 存储的所有消息进行加密。
我想使用 Azure 队列来触发 WebJobs,所以在存储之前采用了下面的这种方法来加密队列消息:
https://docs.microsoft.com/en-us/azure/storage/storage-client-side-encryption
这可以很好地加密队列中的消息。
然后我想写一个 WebJob(或者更好的是,一个 Azure Function)来响应 Queue 消息并对其进行解密和处理。
不幸的是,网络作业总是因异常而失败
System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters
有没有人有办法做到这一点。我什至尝试像示例中那样实现自己的 CustomQueueProcessFactory
但 Azure WebJob 库仅使用 CloudQueueMessage 调用它,而我需要在此之前对其进行加密。
有什么想法吗?
谢谢。
我相信您可以使用 CustomQueueProcessor
通过修改创建方法中的服务客户端选项来完成此操作。
public QueueProcessor Create(QueueProcessorFactoryContext context)
{
...
// demonstrates how the Queue.ServiceClient options can be configured
context.Queue.ServiceClient.DefaultRequestOptions.EncryptionPolicy = policy;
...
}
不幸的是,我们没有在 Azure Function 中提供那种级别的控制(如果您将函数运行时部署为应用服务计划中的站点扩展,您可以破解它,但您不会获得任何消费扩展等)。