Giter Site home page Giter Site logo

digitorus / timestamp Goto Github PK

View Code? Open in Web Editor NEW
71.0 2.0 34.0 40 KB

Time-Stamp Protocol (TSP) implementation for Go as specified in RFC3161

Home Page: https://pkg.go.dev/github.com/digitorus/timestamp?tab=doc

License: BSD 2-Clause "Simplified" License

Go 100.00%
timestamp tsp tsa go golang rfc3161 pki

timestamp's Issues

test output mismatch for CN (timestamp_example_test.go)

Hi,

is this output mismatch while go test just a CN paring error or a problem while verification? Can this be fixed easily?

$ go test
--- FAIL: ExampleCreateRequest_ParseResponse (0.82s)
got:
[140 222 43 143 28 80 96 97 4 176 145 205 188 119 197 142 149 101 26 96 188 163 178 64 230 162 199 171 176 178 173 128]
1.2.3.4.1
CN=www.freetsa.org,OU=TSA,O=Free TSA,L=Wuerzburg,ST=Bayern,C=DE,1.2.840.113549.1.9.1=#0c13627573696c657a617340676d61696c2e636f6d,2.5.4.13=#136d54686973206365727469666963617465206469676974616c6c79207369676e7320646f63756d656e747320616e642074696d65207374616d70207265717565737473206d616465207573696e672074686520667265657473612e6f7267206f6e6c696e65207365727669636573
want:
[140 222 43 143 28 80 96 97 4 176 145 205 188 119 197 142 149 101 26 96 188 163 178 64 230 162 199 171 176 178 173 128]
1.2.3.4.1
CN=www.freetsa.org,OU=TSA,O=Free TSA,L=Wuerzburg,ST=Bayern,C=DE
FAIL
exit status 1
FAIL    github.com/digitorus/timestamp  0.835s
$ go version
go version go1.15.6 linux/amd64

Incorrect CreateRequest function

In your CreateRequest function you have the code

b := make([]byte, 32)

But you need to aware that this length would be valid only in case of your default SHA-256. In most one cases you would fail.

SignedData version value is incorrect

Within the TimeStampResp, the SignedData structure has its version set to 1, but I believe the correct value should be 3.

According to the CMS Spec (RFC 5652). The version field of the SignedData struct should be set to 3 if the encapsulated content type is anything other than 1.2.840.113549.1.7.1.

From section 5.1:

Image

For the TimeStampResp, the encapsulated content type is set to 1.2.840.113549.1.9.16.1.4 (TSTInfo):

Image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.