You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 17, 2018. It is now read-only.
Consider the following replacements for IXmlEncryptor and IXmlDecryptor ...
publicclassCustomXmlEncryptor:IXmlEncryptor{publicCustomXmlEncryptor(){}publicCustomXmlEncryptor(IOptions<CustomDataProtectionOptions>dataProtectionOptions){_key=dataProtectionOptions.Value.Key;}privatebyte[]_key;publicEncryptedXmlInfoEncrypt(XElementplaintextElement){// Code here uses _key to encrypt}}publicclassCustomXmlDecryptor:IXmlDecryptor{publicCustomXmlDecryptor(){}publicCustomXmlDecryptor(IOptions<CustomDataProtectionOptions>dataProtectionOptions){_key=dataProtectionOptions.Value.Key;}privatebyte[]_key;publicXElementDecrypt(XElementencryptedElement){// Code here uses _key to decrypt}}
Both derived classes require a parameterless ctor. The CustomXmlEncryptor always gets the correct _key value via DI with my options-based ctor. However, the CustomXmlDecryptor always gets created using its parameterless ctor, thus it never gets a value in _key from DI.
I have a pathetic workaround using a global static, but I'd like to get that CustomXmlDecryptor on DI. Am I doing it wrong? Is this an unknown bug? Is this a known bug covered by Refactor DI support in DataProtection (DataProtection #134)?