diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-11-16 11:24:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-11-16 15:41:20 +0100 |
commit | 96acbb938662a25cedad5fe6dcca20d7dc4221ab (patch) | |
tree | 819e8648deb9ac45b248db97e015f5749bf61c21 /vcl | |
parent | 5cbaf0504f76892b2b855ca962c9f8821fb50dae (diff) |
vcl PDF sign: initial ESSCertIDv2
Towards writing the complete signing-certificate value.
Change-Id: I0c7f3ddf863f944cc9e763beaf7d92e631dbcd4b
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 79bdad2b2ddf..5543ef023bcc 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6036,8 +6036,25 @@ typedef struct { Extension *extensions; } TimeStampReq; +/** + * Supplies different fields that are used to identify certificates, defined by + * RFC 5035. + */ +struct ESSCertIDv2 +{ +}; + +/** + * This attribute uses the ESSCertIDv2 structure, defined by RFC 5035. + */ struct SigningCertificateV2 { + ESSCertIDv2** certs; + + SigningCertificateV2() + : certs(nullptr) + { + } }; // (Partial) ASN.1 for the time stamp response. Very complicated. Pulled @@ -6256,12 +6273,23 @@ const SEC_ASN1Template TimeStampReq_Template[] = }; /** + * ESSCertIDv2 ::= SEQUENCE { + * } + */ +const SEC_ASN1Template ESSCertIDv2Template[] = +{ + {SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(ESSCertIDv2)}, + {0, 0, nullptr, 0} +}; + +/** * SigningCertificateV2 ::= SEQUENCE { * } */ const SEC_ASN1Template SigningCertificateV2Template[] = { {SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(SigningCertificateV2)}, + {SEC_ASN1_SEQUENCE_OF, offsetof(SigningCertificateV2, certs), ESSCertIDv2Template, 0}, {0, 0, nullptr, 0} }; @@ -7055,7 +7083,12 @@ bool PDFWriter::Sign(PDFSignContext& rContext) } // Add the signing certificate as a signed attribute. + ESSCertIDv2* aCertIDs[2]; + ESSCertIDv2 aCertID; + aCertIDs[0] = &aCertID; + aCertIDs[1] = nullptr; SigningCertificateV2 aCertificate; + aCertificate.certs = &aCertIDs[0]; SECItem* pEncodedCertificate = SEC_ASN1EncodeItem(nullptr, nullptr, &aCertificate, SigningCertificateV2Template); if (!pEncodedCertificate) { |