-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Ability to encrypt variables with RSA Certificate. #38
base: master
Are you sure you want to change the base?
Conversation
try | ||
{ | ||
|
||
var certificate = new X509Certificate2(Convert.FromBase64String(arguments[0])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The certificate is not disposed. Also we should think what key set to use and which store. Ephemeral
seems to be a good choice in this, but I'm not sure of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the Ephemeral key store is not natively availabe in .Net Standard 1.3 or .Net Framework 4.0. It seems to work if I use:new X509Certificate2(Convert.FromBase64String(arguments[0]), (string)null, (X509KeyStorageFlags)32)
but I am not confident it would work on a machine that does not have a later version of .Net installed.
{ | ||
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be inside the catch
statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just using the FormatFunction as an example for this. Would it be preferable for me to just allow the exception to bubble up?
Was curious to see if this feature was a viable option to consider adding?
We do this type of thing manually right now with variables that store the encrypted text and it is a pain when updating certificates.
I can flush out the .Net Framework 4.5.2 tests plus additional test cases if needed.