-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: implement get-plugin-metadata & describe-key command in dotnet #89
Conversation
Codecov Report
@@ Coverage Diff @@
## main #89 +/- ##
=======================================
Coverage 69.60% 69.60%
=======================================
Files 6 6
Lines 306 306
=======================================
Hits 213 213
Misses 87 87
Partials 6 6 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
akv-plugin/proto/key.cs
Outdated
RSA? rsaKey = signingCert.GetRSAPublicKey(); | ||
ECDsa? ecdsaKey = signingCert.GetECDsaPublicKey(); | ||
|
||
if (rsaKey != null) | ||
{ | ||
int bitSize = rsaKey.KeySize; | ||
|
||
if (bitSize == 2048 || bitSize == 3072 || bitSize == 4096) | ||
{ | ||
return new KeySpec("RSA", bitSize); | ||
} | ||
|
||
throw new ValidationException($"RSA key size {bitSize} bits is not supported"); | ||
} | ||
else if (ecdsaKey != null) | ||
{ | ||
int bitSize = ecdsaKey.KeySize; | ||
|
||
if (bitSize == 256 || bitSize == 384 || bitSize == 521) | ||
{ | ||
return new KeySpec("EC", bitSize); | ||
} | ||
|
||
throw new ValidationException($"ECDSA key size {bitSize} bits is not supported"); | ||
} | ||
|
||
throw new ValidationException("Unsupported public key type"); |
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.
Can we have other better way to determine the public key?
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.
We can get the key by signingCert.PublicKey.Key
but PublicKey.Key
is obsolete. It asks me to use the appropriate method to get the public key, such as GetRSAPublicKey
.
So I optimized the code based on current logic.
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
41bb4de
to
c687536
Compare
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
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.
It would better if we have more meaningful documentation and references of protocols.
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
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.
LGTM
Resolve part of #90
Signed-off-by: Junjie Gao [email protected]