Added a dedicated revocation subpackage

The newly created dedicated revocation package is used to encode and
decode revocation information. Signing and verification can now use the
same structures.

While the InfoArchival stucsture can now be created this stucture is currenlty
not embedded into the document. Test cases for obtaining and embedding revocation
information into the InfoArchival struct are also availible.
This commit is contained in:
Paul van Brouwershaven
2017-07-12 20:53:06 +02:00
parent 099b765c01
commit c327f686d5
4 changed files with 265 additions and 16 deletions

View File

@@ -11,26 +11,13 @@ import (
"time"
"bitbucket.org/digitorus/pdf"
"bitbucket.org/digitorus/pdfsign/revocation"
"github.com/digitorus/pkcs7"
"github.com/digitorus/timestamp"
"go/src/log"
"log"
"golang.org/x/crypto/ocsp"
)
type RevocationInfoArchival struct {
CRL RevCRL `asn1:"tag:0,optional,explicit"`
OCSP RevOCSP `asn1:"tag:1,optional,explicit"`
OtherRevInfo OtherRevInfo `asn1:"tag:2,optional,explicit"`
}
type RevCRL []asn1.RawValue
type RevOCSP []asn1.RawValue
type OtherRevInfo struct {
Type asn1.ObjectIdentifier
Value []byte
}
type Response struct {
Error string
@@ -192,7 +179,7 @@ func Verify(file *os.File) (apiResp *Response, err error) {
}
// PDF signature certificate revocation information attribute (1.2.840.113583.1.1.8)
var revInfo RevocationInfoArchival
var revInfo revocation.InfoArchival
p7.UnmarshalSignedAttribute(asn1.ObjectIdentifier{1, 2, 840, 113583, 1, 1, 8}, &revInfo)
// Parse OCSP response