yoursunny / NDNts

NDN libraries for the Modern Web
https://ndnts-docs.ndn.today
ISC License
31 stars 9 forks source link

verifier do not verify the validity time #10

Closed killerdbob closed 2 years ago

killerdbob commented 2 years ago

Hi, I import a cert from a base64 string, and use it to verify the packet. it seems it did not verify the date of the cert.

I use an out-of-date python-ndn cert, and import it into ndnts.

* /pcnl/ndn/video/sz02/live
  +->* /pcnl/ndn/video/sz02/live/KEY/-F%96%1F%40%04%2F%05
       +->* /pcnl/ndn/video/sz02/live/KEY/-F%96%1F%40%04%2F%05/self/v=1649990055921
            Certificate name:
              /pcnl/ndn/video/sz02/live/KEY/-F%96%1F%40%04%2F%05/self/v=1649990055921
            Validity:
              NotBefore: 19700101T000000
              **NotAfter:  20220415T023415**   <--------------------- out of date
            Public key bits:
              MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1h+7WRmW8/n7lJ6cfyMaDiGdYqQH
              9EFjUc5Df1e9RbmtjIXbPLRiCxTC5Dbyh/TY59YvOV8IEQRQQU30t4Y/Dw==
            Signature Information:
              Signature Type: SignatureSha256WithEcdsa
              Key Locator: /pcnl/ndn/video/sz02/live/KEY/-F%96%1F%40%04%2F%05

following is ndnts code,

const sz02 = fromBase64(`
Bv0BTwc9CARwY25sCANuZG4IBXZpZGVvCARzejAyCARsaXZlCANLRVkICC1Glh9A
BC8FCARzZWxmNggAAAGAKxI38RQJGAECGQQANu6AFVswWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAATWH7tZGZbz+fuUnpx/IxoOIZ1ipAf0QWNRzkN/V71Fua2Mhds8
tGILFMLkNvKH9Njn1i85XwgRBFBBTfS3hj8PFl4bAQMcLwctCARwY25sCANuZG4I
BXZpZGVvCARzejAyCARsaXZlCANLRVkICC1Glh9ABC8F/QD9Jv0A/g8xOTcwMDEw
MVQwMDAwMDD9AP8PMjAyMjA0MTVUMDIzNDE1F0YwRAIgcn/wSGmDz7HpNR56mVGF
VLt9xR2q8Qqb0IYBhC48L0wCIBQ//+R3Ll4fZfNpJrGs1G7phhTGGCywyugL2QES
E7QO`
);
const data0 = new Decoder(sz02).decode(Data);
const cert0 = Certificate.fromData(data0);
const verifier = createVerifier(cert0);