There is no direct way to add OBJECT IDENTIFIER to a certificate using Go.
We have found our own solution.
Go provides the ability to add additional SAN information to a certificate
x509.Certificate{
ExtraExtensions: []pkix.Extension{
{
// Here, We add SAN additional with specific ID
},
},
}
2.5.29.17 - , OID SAN 2.5.29.17
, ID 1.2.3.4.5.5 SAN. RID #8. ( 2.5.29.17)
, []byte{0x88, 0x05, 0x2A, 0x03, 0x04, 0x05, 0x05}
0x88 - - #80x05 -0x2A, 0x03, 0x04, 0x05, 0x05 - 1.2.3.4.5.50x2A 42, 40 * 1 + 2, 1 2 - ID.
,
rawValue := []asn1.RawValue{
{FullBytes: []byte{0x88, 0x05, 0x2A, 0x03, 0x04, 0x05, 0x05}},
}
rawByte, _ := asn1.Marshal(rawValue)
_ = x509.Certificate{
ExtraExtensions: []pkix.Extension{
{
Id: asn1.ObjectIdentifier{2, 5, 29, 17},
Value: rawByte,
},
},
}