Skip to content
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

Only supports 2048 bit keys #2

Open
aaronesau-summit opened this issue Mar 8, 2021 · 1 comment
Open

Only supports 2048 bit keys #2

aaronesau-summit opened this issue Mar 8, 2021 · 1 comment

Comments

@aaronesau-summit
Copy link

And if the key isn't 2048 bits, it doesn't raise an error. Instead, it just gives you wrong (trimmed) data. In my case, my key is 3072 bit :/

Looks like it just straight up trims the bytes:

		.PARAMETER Modulus
			The base64 encoded modulus for the RSA algorithm. This should be in big endian order and is expected to
			be 256 bytes long, but will be trimmed or padded if it is shorter or longer.
@hakenmt
Copy link
Contributor

hakenmt commented Mar 9, 2021

I haven't really looked at this in around 3 years, I was attempting to write something purely in PS that needed to deal with PEM encoded keys, but I couldn't depend on BouncyCastle. I'm assuming I included this logic because the ASN.1 encoding had keys that weren't exactly 2048 bits and they needed to be padded or trimmed to prevent exceptions. Could you modify the logic here in your module to not perform the trimming? Just comment out that line and see if the conversion works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants