aspnet/DataProtection

CreateEncryptorInstance runs multiple times

Closed this issue · 1 comments

Comparing output of Azure sample,

1.0 release

dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[18]
      Found key {f0146984-4a7a-4a28-bfc0-cd3283e1b1a3}.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver[13]
      Considering key {f0146984-4a7a-4a28-bfc0-cd3283e1b1a3} with expiration date 2017-07-04 17:24:35Z as default key.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngCbcAuthenticatedEncryptorDescriptor[4]
      Opening CNG algorithm 'AES' from provider '(null)' with chaining mode CBC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngCbcAuthenticatedEncryptorDescriptor[3]
      Opening CNG algorithm 'SHA256' from provider '(null)' with HMAC.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider[2]
      Using key {f0146984-4a7a-4a28-bfc0-cd3283e1b1a3} as the default key.
trce: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector[31]
      Performing protect operation to key {f0146984-4a7a-4a28-bfc0-cd3283e1b1a3} with purposes ('sample-purpose').
CfDJ8IRpFPB6SihKv8DNMoPhsaN-ljs8dzZGN6D9MsYXlZesolbDKUgHLzkDaTQ6ppjkx6ke9jity-ZI_XtiXpl0w57yJFghk0Qlq_Wvf-XG-x4c7f8VnOUzDbgUmY4VOumZTA

Current:

dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[18]
      Found key {c5125edb-70b6-4e41-b4d8-8de8127812bf}.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver[13]
      Considering key {c5125edb-70b6-4e41-b4d8-8de8127812bf} with expiration date 2017-07-04 19:30:00Z as default key.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[4]
      Opening CNG algorithm 'AES' from provider '(null)' with chaining mode CBC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[3]
      Opening CNG algorithm 'SHA256' from provider '(null)' with HMAC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[4]
      Opening CNG algorithm 'AES' from provider '(null)' with chaining mode CBC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[3]
      Opening CNG algorithm 'SHA256' from provider '(null)' with HMAC.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider[2]
      Using key {c5125edb-70b6-4e41-b4d8-8de8127812bf} as the default key.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[4]
      Opening CNG algorithm 'AES' from provider '(null)' with chaining mode CBC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[3]
      Opening CNG algorithm 'SHA256' from provider '(null)' with HMAC.
trce: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector[31]
      Performing protect operation to key {c5125edb-70b6-4e41-b4d8-8de8127812bf} with purposes ('sample-purpose').
CfDJ8NteEsW2cEFOtNiN6BJ4Er8_XioPI4dY5PhqFVzCzOifKCTi8X6zqTAopL58e6igrJOS1hUkwkjOx3dI4iPQ4h7mnrxBesq26LzKaFLAwEKHDaNet0hrMA6iaoYXOHhGYQ

This shows the creation of encryptor instance happens multiple times. Need to investigate if this is necessary.