[Libreoffice-commits] .: Branch 'feature/pdf-signing' - vcl/source

Gökcen Eraslan gokcen at kemper.freedesktop.org
Sat Jul 7 23:20:23 PDT 2012


 vcl/source/gdi/pdfwriter_impl.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 9ba7fda79cd36a20732fee663f52bdb4946cb2cf
Author: Gökçen Eraslan <gokcen.eraslan at gmail.com>
Date:   Sun Jul 8 09:19:49 2012 +0300

    Get der encoded certificate to use in NSS.
    
    Change-Id: I01b033b2ec91d97352c91d732530473d75ad5e3a

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 16f2a0d..7b3cc6f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6155,6 +6155,10 @@ bool PDFWriterImpl::emitSignature()
 
 bool PDFWriterImpl::finalizeSignature()
 {
+
+    if (!m_aContext.SignCertificate.is())
+        return false;
+
     // 1- calculate last ByteRange value
     sal_uInt64 nOffset = ~0U;
     CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nOffset ) ) );
@@ -6177,6 +6181,13 @@ bool PDFWriterImpl::finalizeSignature()
     // 3- create the PKCS#7 object using NSS
     // use  m_aContext.SignCertificate and m_aContext.SignPassword as certificate and private key password
     // SignCertificate->getEncoded is DER encoded certificate
+    com::sun::star::uno::Sequence< sal_Int8 > derEncoded = m_aContext.SignCertificate->getEncoded();
+
+    if (!derEncoded.hasElements())
+        return false;
+
+    sal_Int8* n_derArray = derEncoded.getArray();
+    sal_Int32 n_derLength = derEncoded.getLength();
 
     // 4- overwrite the PKCS7 content to the m_nSignatureContentOffset
     CHECK_RETURN( (osl_File_E_None == osl_setFilePos( m_aFile, osl_Pos_Absolut, m_nSignatureContentOffset ) ) );


More information about the Libreoffice-commits mailing list