PKI.js icon indicating copy to clipboard operation
PKI.js copied to clipboard

Deserialize a certificate or ASN1 LocalBaseBlock

Open maganuk opened this issue 3 years ago • 1 comments

Hi,

We have bunch of certificates in our trust store and a user certificate needs to be validated against this trust store dynamically, which means that with every request we need to reload all certificates into the trust store. Currently just loading 4 certificates by doing const asn1 = fromBER(ber) and then new Certificate({ schema: asn1.result }) is taking about 250ms.

I see there is a toJSON extension available for both Certificates and for asn1.result. Is there any extension available to deserialize this json output to convert back into a Certificate or a ASN1 LocalBaseBlock object? This will help reduce the load times significantly.

Thanks Vishal

maganuk avatar Jul 11 '21 12:07 maganuk

We have bunch of certificates in our trust store and a user certificate needs to be validated against this trust store dynamically, which means that with every request we need to reload all certificates into the trust store. Currently just loading 4 certificates by doing const asn1 = fromBER(ber) and then new Certificate({ schema: asn1.result }) is taking about 250ms.

Would it be better to keep parsed certificates in a global variable without parsing them for each incoming request?

I see there is a toJSON extension available for both Certificates and for asn1.result. Is there any extension available to deserialize this json output to convert back into a Certificate or a ASN1 LocalBaseBlock object?

I think it's impossible

microshine avatar Jul 21 '21 09:07 microshine