[Libreoffice-commits] core.git: vcl/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Nov 16 14:42:09 UTC 2016
vcl/source/gdi/pdfwriter_impl.cxx | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
New commits:
commit 96acbb938662a25cedad5fe6dcca20d7dc4221ab
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 16 11:24:46 2016 +0100
vcl PDF sign: initial ESSCertIDv2
Towards writing the complete signing-certificate value.
Change-Id: I0c7f3ddf863f944cc9e763beaf7d92e631dbcd4b
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 79bdad2..5543ef0 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)
{
More information about the Libreoffice-commits
mailing list