summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
authorGökçen Eraslan <gokcen.eraslan@gmail.com>2012-07-08 09:19:49 +0300
committerGökçen Eraslan <gokcen.eraslan@gmail.com>2012-07-08 09:19:49 +0300
commit9ba7fda79cd36a20732fee663f52bdb4946cb2cf (patch)
tree06984ae7e2cdb61f5906f97b0fdc52ab1b82a8df /vcl/source/gdi/pdfwriter_impl.cxx
parent5f995a0d8ffea95bf6eecf5215da8178159be0ca (diff)
Get der encoded certificate to use in NSS.
Change-Id: I01b033b2ec91d97352c91d732530473d75ad5e3a
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 16f2a0de08dd..7b3cc6faf122 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 ) ) );