我正在通过以下方式加密表格。
public TableRequestOptions EncryptTableStorage()
{
// Create the IKey used for encryption.
var key = new RsaKey("mykey");
var policy = new TableEncryptionPolicy(key, null);
TableRequestOptions options = new TableRequestOptions()
{
EncryptionPolicy = policy
};
return options;
}
我的加密实体
[EncryptProperty]
public string ConsumerId { get; set; }
检索时,我正在使用以下代码
var query = new TableQuery<CloudModelDetail>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, cloudModelDetail.PartitionKey));
foreach (var entity in azureStorageAccount.VerifyCloudTable.ExecuteQuery(query, azureStorageAccount.EncryptTableStorage()))
{
Console.WriteLine("{0}, {1}\t{2}\t{3}", entity.PartitionKey, entity.RowKey,
entity.ConsumerId, entity.ScoreVariables);
}
我收到一条错误消息,说解密错误。内部异常显示“解码 OAEP 填充时发生错误”。