-
Notifications
You must be signed in to change notification settings - Fork 5
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
encoding and decoding certificate blobs #12
Comments
A property consists of a data structure that looks like this (taken from the certinject comments):
In other words, there's a 32-bit little-endian unsigned "Property ID", a 32-bit little-endian unsigned value that's probably a version field (it's always 0x1), a 32-bit little-endian unsigned size, and then raw data with a size in bytes equal to the value of the size field. A blob is simply a concatenated sequence of properties. It would be useful to have a Go Also, lists of property ID's are in wincrypt.h and certenroll.h. The latter has more properties; properties that exist in the former appear to exist in Windows XP; properties that exist in the latter appear to exist in Windows Vista. |
The values from |
The three Property ID's that look immediately interesting to me are:
The first two both take the form of the Value of an Extension (see the |
This is a place I am collecting
using certmgr to add a certificate, a ProtectedRoots key is created/updated
With no certificates added, the empty ProtectedRoots is
With a single certificate, the ProtectedRoots key contains
Using syscalls, trusting a certificate creates the same popup as certmgr
Using certinject, it only works with system + Root, and the blob header is different
Here is certinject injected certificate into the current-user + Root store, which doesn't get recognized by the browser like the certinject system+Root or the syscall technique (the one with the popup). I think its because we don't modify the ProtectedRoots, not sure.
Headers (first bytes of the blob)
In each case, the registry blob contains a header containing various sorts of meta data, and then the rest is the DER/ASN.1 certificate bytes.
In the example certificate, the certificate bytes begin with
30 82 03 79
and end withE1 36 3A D5
89
and the SHA-1 is (20 bytes)99 C1...34 97
Here is a list of a few discovered headers:
Added with certinject1:
??? KEY_IDENTIFIER A 20-byte array containing the SHA-1 hash of the certificate subject public key. ??? (works (as administrator)in System+Root, Enterprise+Root)
Added with certmgr:
Info
Certificate as Registry Key
Useful References
CryptoAPI constants
Certificate BLOB Properties
Common Windows Structures
[MS-CRTD]: Certificate Templates Structure
Microsoft Certificate Encoding
Typical Encoded Certificate from Vista
Certificate Properties
Example Certificate
The example self-signed certificate is the one found here: https://selfsigned.badssl.com/
It expires on Friday, October 8, 2021 at 11:41:52 PM.
SHA-1 Fingerprint (unfortunately used all over the place, still.)
SHA-256 Fingerprint:
Since we don't control this certificate, at some point it will expire and we will have to patch this test.
The text was updated successfully, but these errors were encountered: