mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 03:08:28 +08:00
fix
This commit is contained in:
@ -23,8 +23,7 @@ HEADERS += \
|
||||
include/Certificate.h \
|
||||
include/CertificateCommon.h \
|
||||
include/OOXMLSigner.h \
|
||||
include/OOXMLVerifier.h \
|
||||
include/PDFSigner.h
|
||||
include/OOXMLVerifier.h
|
||||
|
||||
HEADERS += \
|
||||
src/XmlCanonicalizator.h \
|
||||
@ -35,8 +34,7 @@ SOURCES += \
|
||||
src/XmlTransform.cpp \
|
||||
src/CertificateCommon.cpp \
|
||||
src/OOXMLSigner.cpp \
|
||||
src/OOXMLVerifier.cpp \
|
||||
src/PDFSigner.cpp
|
||||
src/OOXMLVerifier.cpp
|
||||
|
||||
core_windows {
|
||||
HEADERS += src/Certificate_mscrypto.h
|
||||
|
||||
@ -1290,11 +1290,11 @@ namespace PdfWriter
|
||||
m_pXref = NULL;
|
||||
return true;
|
||||
}
|
||||
void CDocument::Sign(const unsigned int& unPageNum, const TRect& oRect, ICertificate* pCertificate)
|
||||
void CDocument::Sign(const unsigned int& unPageNum, const TRect& oRect, ICertificate* pCertificate)
|
||||
{
|
||||
CSignatureField* pField = CreateSignatureField();
|
||||
if (m_pSignatureDict)
|
||||
m_pSignatureDict->SetCert(pCertificate);
|
||||
m_pSignatureDict->SetCert(pCertificate);
|
||||
|
||||
// Сейчас подпись невидимая
|
||||
// TODO DR, DA и AP (внешнее отображение подписи) должны заполняться в CPdfRenderer::AddFormField(const CFormFieldInfo &oInfo)
|
||||
|
||||
@ -159,7 +159,7 @@ namespace PdfWriter
|
||||
CPage* AddPage(int nPageIndex);
|
||||
bool DeletePage(int nPageIndex);
|
||||
bool AddToFile(const std::wstring& wsPath, const std::wstring& sTrailer, const std::wstring& sInfo);
|
||||
void Sign(const unsigned int& unPageNum, const TRect& oRect, ICertificate* pCert);
|
||||
void Sign(const unsigned int& unPageNum, const TRect& oRect, ICertificate* pCert);
|
||||
CSignatureDict* GetSignatureDict() { return m_pSignatureDict; }
|
||||
private:
|
||||
|
||||
|
||||
@ -335,6 +335,11 @@ namespace PdfWriter
|
||||
// TODO шифрование записи Contents, для случая одновремменного запароливания и сертификации pdf
|
||||
pStream->Write(pContents, NULL);
|
||||
RELEASEOBJECT(pContents);
|
||||
|
||||
// Стереть лишний >
|
||||
BYTE cChar = '0';
|
||||
pStream->Seek(pStream->Tell() - 1, EWhenceMode::SeekSet);
|
||||
pStream->Write(&cChar, 1);
|
||||
}
|
||||
}
|
||||
void CSignatureDict::SetCert(ICertificate* pCert)
|
||||
|
||||
@ -79,14 +79,14 @@ namespace PdfWriter
|
||||
void SetByteRange(int nLen1, int nOffset2);
|
||||
void ByteRangeOffset(int nBegin, int nEnd);
|
||||
void WriteToStream(CStream* pStream, int nFileEnd);
|
||||
void SetCert(ICertificate* pCert);
|
||||
void SetCert(ICertificate* pCert);
|
||||
|
||||
void SetName(const std::string& sName);
|
||||
void SetReason(const std::string& sReason);
|
||||
void SetContacts(const std::string& sContacts);
|
||||
void SetDate();
|
||||
private:
|
||||
ICertificate* m_pCertificate;
|
||||
ICertificate* m_pCertificate;
|
||||
|
||||
int m_nLen1; // Длина первого интервала сигнатуры
|
||||
int m_nOffset2; // Начало второго интервала сигнатуры
|
||||
|
||||
@ -85,7 +85,7 @@ int main()
|
||||
{
|
||||
std::wstring sCertificateFile = NSFile::GetProcessDirectory() + L"/test.pfx";
|
||||
std::wstring sPrivateKeyFile = L"";
|
||||
std::string sCertificateFilePassword = "Sveta03011997";
|
||||
std::string sCertificateFilePassword = "test";
|
||||
std::string sPrivateFilePassword = "";
|
||||
|
||||
pCertificate = NSCertificate::FromFiles(sPrivateKeyFile, sPrivateFilePassword, sCertificateFile, sCertificateFilePassword);
|
||||
@ -100,7 +100,6 @@ int main()
|
||||
|
||||
RELEASEOBJECT(pReader);
|
||||
RELEASEINTERFACE(pApplicationFonts);
|
||||
|
||||
RELEASEOBJECT(pCertificate);
|
||||
return 0;
|
||||
if (bResult && pReader->EditPdf(&pdfWriter, sPassword))
|
||||
|
||||
Reference in New Issue
Block a user