@@ -29,29 +29,29 @@ func PKCS7Sign(data []byte, key *rsa.PrivateKey, cert *x509.Certificate) ([]byte
2929 return nil , fmt .Errorf ("marshal digest: %w" , err )
3030 }
3131
32- serializedPKInitOID , err := asn1 .Marshal (asn1. ObjectIdentifier { 1 , 3 , 6 , 1 , 5 , 2 , 3 , 1 } )
32+ serializedPKInitOID , err := asn1 .Marshal (idPKINITAuthDataOID )
3333 if err != nil {
3434 return nil , fmt .Errorf ("marshal PKInit OID: %w" , err )
3535 }
3636
3737 sha1AlgorithmIdentifier := pkix.AlgorithmIdentifier {
38- Algorithm : asn1. ObjectIdentifier { 1 , 3 , 14 , 3 , 2 , 26 } ,
38+ Algorithm : sha1HashOID ,
3939 }
4040
4141 rsaWithSHA1AlgorithmIdentifier := pkix.AlgorithmIdentifier {
42- Algorithm : asn1. ObjectIdentifier { 1 , 2 , 840 , 113549 , 1 , 1 , 5 } ,
42+ Algorithm : sha1WithRSAEncryptionOID ,
4343 }
4444
4545 authenticatedAttributes := []Attribute {
4646 {
4747 // ContentType
48- Type : asn1. ObjectIdentifier { 1 , 2 , 840 , 113549 , 1 , 9 , 3 } ,
48+ Type : contentTypeOID ,
4949 // id-pkinit-authData
5050 Value : asn1.RawValue {Tag : 17 , IsCompound : true , Bytes : serializedPKInitOID },
5151 },
5252 {
5353 // MessageDigest
54- Type : asn1. ObjectIdentifier { 1 , 2 , 840 , 113549 , 1 , 9 , 4 } ,
54+ Type : messageDigestOID ,
5555 Value : asn1.RawValue {Tag : 17 , IsCompound : true , Bytes : serializedDigest },
5656 },
5757 }
@@ -66,7 +66,7 @@ func PKCS7Sign(data []byte, key *rsa.PrivateKey, cert *x509.Certificate) ([]byte
6666 DigestAlgorithmIdentifiers : []pkix.AlgorithmIdentifier {sha1AlgorithmIdentifier },
6767 ContentInfo : ContentInfo {
6868 // id-pkinit-authData
69- ContentType : asn1. ObjectIdentifier { 1 , 3 , 6 , 1 , 5 , 2 , 3 , 1 } ,
69+ ContentType : idPKINITAuthDataOID ,
7070 Content : asn1.RawValue {Class : 2 , Tag : 0 , Bytes : serializedData , IsCompound : true },
7171 },
7272 Certificates : rawCert ,
@@ -90,7 +90,7 @@ func PKCS7Sign(data []byte, key *rsa.PrivateKey, cert *x509.Certificate) ([]byte
9090
9191 contentInfo := ContentInfo {
9292 // signed data
93- ContentType : asn1. ObjectIdentifier { 1 , 2 , 840 , 113549 , 1 , 7 , 2 } ,
93+ ContentType : signedDataOID ,
9494 Content : asn1.RawValue {Class : 2 , Tag : 0 , Bytes : signedDataBytes , IsCompound : true },
9595 }
9696
0 commit comments