I am encrypting the table in the following way.
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;
}
My Encrypted entity
[EncryptProperty]
public string ConsumerId { get; set; }
While retrieving, I am using the following code
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);
}
I am getting an error saying decryption error. The inner exception says "Error occurred while decoding OAEP padding."