Closed The-Lum closed 10 months ago
The encoding of the extension is correct.
I don't have much time to explain it in detail, but in a nutshell:
The ASN.1 module with the PrivateKeyUsagePeriod extension in RFC 5280 (or 3280) is implicitly tagged, which means the default is IMPLICIT.
Implicit tagging basically means that the byte with the data type is replaced with the tag. So you have to know the ASN.1 definition in order to correctly parse the extension.
The KSE ASN.1 viewer does not know the real data type because it does a generic processing using heuristics. It assumes OCTET STRING as the data type here which is reasonable looking at the data but actually wrong. I can take a look at the ASN.1 viewer, maybe this can be improved.
Hello @kaikramer,
Thanks for all those precisions.
In the other hand:
Regards, Th.
Hello @kaikramer, and all,
After quick analysis (See A.2 Implicitly Tagged Module, 1988 Syntax):
Sorry for the noise. 📣
Then the main goal now will be:
Regards, Th.
Then the main goal now will be: How to manage malformed certificate?
What do you mean by this? If you mean that KSE should somehow handle malformed certificates, then I disagree. There are so many ways to create malformed certificates and to add workarounds for all these is simply not possible. If input data contains garbage then KSE will show an error.
I will close this issue now, as there is no bug in KSE. I will enhance the handling of implicitly tagged ASN.1 objects in the ASN.1 viewer a bit, but being a heuristic this will never be perfect.
Hello @kaikramer,
I will close this issue now, as there is no bug in KSE.
I agree. And sorry for the noise of this report...
I will enhance the handling of implicitly tagged ASN.1 objects in the ASN.1 viewer a bit, but being a heuristic this will never be perfect.
Thanks for this enhancement.
Regards, Th.
Describe the bug
Issue on format of
Private Key Usage Period
extension:GeneralizedTime
.Maybe I'm missing something....
Reference: RFC 3280
From the spec. RFC 3280 (§4.2.1.4 Private Key Usage Period):
Creating
Private Key Usage Period
extensionIt seems that the format of date fields for
Private Key Usage Period
are erroneous. ⁉️Steps to reproduce the behavior (on
V5.5.3
withPKCS #12
KeyStore):Then:
The dates should be in the
GeneralizedTime
format, and not simply onOctet String
.Probably impacted code: https://github.com/kaikramer/keystore-explorer/blob/a7f95d1a09689fa1543e7e364bc2844db3b329ea/kse/src/main/java/org/kse/gui/dialogs/extensions/DPrivateKeyUsagePeriod.java#L223
Here is my example cert.:
Reading
Private Key Usage Period
extensionWith certificate with
GeneralizedTime
onPrivate Key Usage Period
:We observe this Java error:
Probably impacted code: https://github.com/kaikramer/keystore-explorer/blob/a7f95d1a09689fa1543e7e364bc2844db3b329ea/kse/src/main/java/org/kse/crypto/x509/X509Ext.java#L711
Environment