CertificateSigningRequest
CertificateSigningRequest copied to clipboard
CSR Enhancement : CSR To Self Signed Certificate
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
SerialNumber was added in #59. Feel free to follow the process in 59 to add the rest of the fields and open a PR.
Stale issue message
Stale issue message
Stale issue message