J
J
jajabin2022-03-11 09:35:08
go
jajabin, 2022-03-11 09:35:08

Proper implementation of the rfc2634 framework in Go?

I implemented the rfc2634 structures in Go in the following way.

SigningCertificate ::=  SEQUENCE {
    certs        SEQUENCE OF ESSCertID,
    policies     SEQUENCE OF PolicyInformation OPTIONAL
}

id-aa-signingCertificate OBJECT IDENTIFIER ::= { iso(1)
    member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
    smime(16) id-aa(2) 12 }

ESSCertID ::=  SEQUENCE {
     certHash                 Hash,
     issuerSerial             IssuerSerial OPTIONAL
}

Hash ::= OCTET STRING -- SHA1 hash of entire certificate

IssuerSerial ::= SEQUENCE {
     issuer                   GeneralNames,
     serialNumber             CertificateSerialNumber
}

var oidAttributeSigningCert   = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 2, 12}
type SignerCertificate struct {
  SigningCertificate SigningCertificate `asn1:"sequence"`
  Policies           PolicyInformation  `asn1:"sequence,optional"`
}

type PolicyInformation struct {
}

type SigningCertificate struct {
  ESSCertID ESSCertID `asn1:"sequence"`
}

type ESSCertID struct {
  IssuerAndSerial IssuerAndSerial `asn1:"optional"`
  Hash            []byte          `asn1:"explicit,tag:0"`
}


I add this attribute to the signature, it is formed without errors, I check it on any verifier, there is an error in parsing ans1 , it displays data that was encoded before the certificate (it is not shown by the verifier). I'm assuming it's the structure tags, how do I set them correctly to implement the rfc structure?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question