fotisl / ctutils Goto Github PK
View Code? Open in Web Editor NEWJavascript Certificate Transparency Utilities
License: BSD 3-Clause "New" or "Revised" License
Javascript Certificate Transparency Utilities
License: BSD 3-Clause "New" or "Revised" License
Good job, Fotis!
But your decoding/encoding of SignedCertificateTimestamp
is not precisely correct. Your problem that you missed just one detail in documentation.
So, definition of the SignedCertificateTimestamp
class looks like:
struct {
Version sct_version;
LogID id;
uint64 timestamp;
CtExtensions extensions;
digitally-signed struct {
Version sct_version;
SignatureType signature_type = certificate_timestamp;
uint64 timestamp;
LogEntryType entry_type;
select(entry_type) {
case x509_entry: ASN.1Cert;
case precert_entry: PreCert;
} signed_entry;
CtExtensions extensions;
};
} SignedCertificateTimestamp;
And in fact you decoded almost all from the data. Except that you missed that digitally-signed
is itself a pre-defined type:
struct {
SignatureAndHashAlgorithm algorithm;
opaque signature<0..2^16-1>;
} DigitallySigned;
And the SignatureAndHashAlgorithm
has this definition:
enum {
none(0), md5(1), sha1(2), sha224(3), sha256(4), sha384(5),
sha512(6), (255)
} HashAlgorithm;
enum { anonymous(0), rsa(1), dsa(2), ecdsa(3), (255) }
SignatureAlgorithm;
struct {
HashAlgorithm hash;
SignatureAlgorithm signature;
} SignatureAndHashAlgorithm;
And when you decode signature like this:
const signature = sctBinView.slice(43 + extLen).buffer;
then you loose information about hashAlgorithm
, signatureAlgorithm
and correct signatureLength
- all these would be in your incorrect block for signature.
For the further reading I do recommend you this link.
Also I want to say that recently I append to PKIjs support for decoding/encoding the SignedCertificateTimestamp
class - check it here. There is no verify
function there, but probably I would implement it soon.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.