-
Notifications
You must be signed in to change notification settings - Fork 5k
Adding an attribute in CSR generated using CertificateRequest class. #27417
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
Comments
Hi, I debugged it further and figured out that sending a set of extension request to CA is fine. The issue is in the encoding of password. MDM server is expecting password to be a PRINTABLESTRING, but the CSR had it as OCTET STRING. I found X509Extension has another way to create set using AsnEncodedData as below.
Here I do see there is option to set attribute as PrintableString, but when CSR is generated I still see value as OCTET STRING. How can I set value as PRINTABLE STRING? |
Went through the library code and found that extensions are always added as octet string. This is the method called to encode the extension. So there is no way to encode it to printable or UTF8 string?
|
The |
Thanks for clarifying @bartonjs. Is this going to be supported for CSR anytime soon? |
You're the first person to bring it up; so it's not planned work at this time, no. |
ok thanks @bartonjs |
Hey @NitinKMathur ,Got any update on this how to add ChallengePassword Attribute with CertificateRequest? |
Hi @bartonjs , |
It's not currently possible. There's other planned work in this area for .NET 7 so this might end up being done in the next couple of months... but that doesn't help you today. |
This will be possible in .NET 7 (as of #73023). It's not super convenient, but it is possible now. CertificateRequest req = ...;
AsnWriter writer = new AsnWriter(AsnEncodingRules.DER);
writer.WriteUtf8String(challengePassword);
req.OtherRequestAttributes.Add(
new AsnEncodedData(
new Oid("1.2.840.113549.1.9.7", null),
writer.Encode()));
...
string reqPem = req.CreateSigningRequestPem(); |
I was able to make it work, it's really long. Let me know if you still need
help with this. Cheers!
…On Wed, Aug 3, 2022 at 4:49 PM Jeremy Barton ***@***.***> wrote:
This will be possible in .NET 7 (as of #73023
<#73023>). It's not super
convenient, but it is possible now.
CertificateRequest req = ...;
AsnWriter writer = new AsnWriter(AsnEncodingRules.DER);writer.WriteUtf8String(challengePassword);
req.OtherRequestAttributes.Add(
new AsnEncodedData(
new Oid("1.2.840.113549.1.9.7", null),
writer.Encode()));
...
string reqPem = req.CreateSigningRequestPem();
—
Reply to this email directly, view it on GitHub
<#27417 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB47KJMDHCX4JMVIBZNYDNTVXLLOPANCNFSM5UUUYHIQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Nitin Mathur
|
Hi,
I am using CertificateRequest class to generate CSR for an SCEP server. The CSR requires challengePassword attribute. I understand the attribute has to be added using CertificateExtensions property. Below is my code for the same.
I ran openssl asn1parse to see if attribute is added properly in CSR, below is the output of the command.
Everything looks fine, except the highlighted object. The expected output should be as below:
Server is failing to extract challengePassword because it's not finding it at expected position. My doubt is, is it right way to add an attribute in CSR request, or I am doing something wrong?
The text was updated successfully, but these errors were encountered: