-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[API Proposal]: RSA.GetMaxOutputSize #78175
Copy link
Copy link
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Securityin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Securityin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Type
Fields
Give feedbackNo fields configured for issues without a type.
Background and motivation
This is a proposal for the discussion in #67059. We have some helpers for {EC}DSA for getting signature sizes. This adds a complementary API for RSA. The method handles a "right" size for encryption and signing, and a "worst case" for decryption.
This is useful if you want to stackalloc or rent a buffer to hold a signature and need to know how much data you need.
Remark:
I considered what this might look like for ECDiffieHellman derived keys. It's a little easier for developers to reason about those sizes from
DeriveKeyFrom{Hash,Hmac}without a helper, so I didn't propose anything there.API Proposal
API Usage
Alternative Designs
Do nothing. Expect that developers know
(KeySize + 7) / 8is correct.Risks
No response