CertificateSigningRequest icon indicating copy to clipboard operation
CertificateSigningRequest copied to clipboard

CSR Enhancement : CSR To Self Signed Certificate

Open Manoj009sahu opened this issue 3 years ago • 1 comments

Hello,

I am trying to Generate Self-Signed Certificate from the generated CSR.

The Field missing in the CSR is

SerialNumber, Validity, Issuer

i don't know this Information can helpful or not, But If we need to Generate Self-Signed Certificate i think if we add the above information while creating certificate info then may be it will treat as a Self-Signed Certificate

Let me correct if i am wrong.

and anyone can help me with the code sample how i could add these things in code.

for your reference i tried to add serial number in this way but when i tried to check weather it generate correct or not from https://redkestrel.co.uk/products/decoder/

its unable to decode

MY CODE SAMPLE

in the function : func buldCertificationRequestInfo(_ publicKeyBits: Data) -> Data

i try to add serial number this way

//Add Serial Number let serialNumberString = "123" var serialNumber = Data(capacity: 128) appendSerialNumber(objectSerialNumber, value: serialNumberString, into: &serialNumber) enclose(&serialNumber, by: sequenceTag) certificationRequestInfo.append(serialNumber)

here objectSerialNumber is : private let objectSerialNumber: [UInt8] = [0x06, 0x03, 0x55, 0x04, 0x05]

private func appendSerialNumber(_ what: [UInt8], value: String, into: inout Data ) { var serialNumber = Data(capacity: 128)

    serialNumber.append(what, count: what.count)
    appendUTF8String(string: value, into: &serialNumber)
    enclose(&serialNumber, by: sequenceTag)
    enclose(&serialNumber, by: setTag)
    
    into.append(serialNumber)
}

Thanks

Manoj009sahu avatar Feb 13 '22 15:02 Manoj009sahu

SerialNumber was added in #59. Feel free to follow the process in 59 to add the rest of the fields and open a PR.

cbaker6 avatar Aug 03 '22 16:08 cbaker6

Stale issue message

github-actions[bot] avatar May 14 '23 00:05 github-actions[bot]

Stale issue message

github-actions[bot] avatar Jul 16 '23 00:07 github-actions[bot]

Stale issue message

github-actions[bot] avatar Sep 16 '23 00:09 github-actions[bot]