Hi,
I am trying to determine the certificate template used. offcourse this is only used when the certificate is issued by a microsoft CA.
I do the following:
with open("C:\\cert\\xyz.crt", "rb") as cert_file:
cert_data = cert_file.read()
# Parse the certificate
cert = x509.load_pem_x509_certificate(cert_data, default_backend())
# Find the Certificate Template Information extension
cert_template_extension = None
extension = None
for ext in cert.extensions:
if ext.oid.dotted_string == "1.3.6.1.4.1.311.21.7":
extension = ext
print(ext.value.value)
ext.value.value:
b'0.\x06&+\x06\x01\x04\x01\x827\x15\x08\x86\xf6\xf87\x86\x8e\xf4$\x82\xd5\x91\x02\x86\xa3\xb83\x84\x9c\xe9>x\x81\xbc\xdb(\x81\xb0\xf7`\x02\x01d\x02\x01D'
it would be helpful to have it parsed correctly. It should translate to something like this:
Template=1.3.6.1.4.1.311.21.8.14531639.12827172.5589122.13163571.8860862.120.3091880.2898912
Primair versionnumber=100
Secundair versionnumber=68
Info: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wcce/9da866e5-9ce9-4a83-9064-0d20af8b2ccf
CertificateTemplateOID ::= SEQUENCE {
templateID OBJECT IDENTIFIER,
templateMajorVersion INTEGER (0..4294967295) OPTIONAL,
templateMinorVersion INTEGER (0..4294967295) OPTIONAL
} --#public
ext.value:
<UnrecognizedExtension(oid=<ObjectIdentifier(oid=1.3.6.1.4.1.311.21.7, name=Unknown OID)>, value=b'0.\x06&+\x06\x01\x04\x01\x827\x15\x08\x86\xf6\xf87\x86\x8e\xf4$\x82\xd5\x91\x02\x86\xa3\xb83\x84\x9c\xe9>x\x81\xbc\xdb(\x81\xb0\xf7\x02\x01d\x02\x01D')> b'0.\x06&+\x06\x01\x04\x01\x827\x15\x08\x86\xf6\xf87\x86\x8e\xf4$\x82\xd5\x91\x02\x86\xa3\xb83\x84\x9c\xe9>x\x81\xbc\xdb(\x81\xb0\xf7\x02\x01d\x02\x01D'
Is it possible to implement this?
Kind Regards
Hi,
I am trying to determine the certificate template used. offcourse this is only used when the certificate is issued by a microsoft CA.
I do the following:
ext.value.value:
b'0.\x06&+\x06\x01\x04\x01\x827\x15\x08\x86\xf6\xf87\x86\x8e\xf4$\x82\xd5\x91\x02\x86\xa3\xb83\x84\x9c\xe9>x\x81\xbc\xdb(\x81\xb0\xf7`\x02\x01d\x02\x01D'
it would be helpful to have it parsed correctly. It should translate to something like this:
Template=1.3.6.1.4.1.311.21.8.14531639.12827172.5589122.13163571.8860862.120.3091880.2898912
Primair versionnumber=100
Secundair versionnumber=68
Info: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wcce/9da866e5-9ce9-4a83-9064-0d20af8b2ccf
ext.value:
<UnrecognizedExtension(oid=<ObjectIdentifier(oid=1.3.6.1.4.1.311.21.7, name=Unknown OID)>, value=b'0.\x06&+\x06\x01\x04\x01\x827\x15\x08\x86\xf6\xf87\x86\x8e\xf4$\x82\xd5\x91\x02\x86\xa3\xb83\x84\x9c\xe9>x\x81\xbc\xdb(\x81\xb0\xf7
\x02\x01d\x02\x01D')> b'0.\x06&+\x06\x01\x04\x01\x827\x15\x08\x86\xf6\xf87\x86\x8e\xf4$\x82\xd5\x91\x02\x86\xa3\xb83\x84\x9c\xe9>x\x81\xbc\xdb(\x81\xb0\xf7\x02\x01d\x02\x01D'Is it possible to implement this?
Kind Regards