OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/fpdf_edit/editint.h" | 7 #include "core/fpdfapi/fpdf_edit/editint.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 CFX_ByteStringC bsBuffer(buffer.data(), buffer.size()); | 2004 CFX_ByteStringC bsBuffer(buffer.data(), buffer.size()); |
2005 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); | 2005 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); |
2006 return; | 2006 return; |
2007 } | 2007 } |
2008 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); | 2008 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); |
2009 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { | 2009 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { |
2010 if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { | 2010 if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { |
2011 CPDF_StandardSecurityHandler handler; | 2011 CPDF_StandardSecurityHandler handler; |
2012 CFX_ByteString user_pass = m_pParser->GetPassword(); | 2012 CFX_ByteString user_pass = m_pParser->GetPassword(); |
2013 uint32_t flag = PDF_ENCRYPT_CONTENT; | 2013 uint32_t flag = PDF_ENCRYPT_CONTENT; |
2014 handler.OnCreate(m_pEncryptDict, m_pIDArray, (const uint8_t*)user_pass, | 2014 handler.OnCreate(m_pEncryptDict, m_pIDArray, user_pass.AsStringC(), flag); |
2015 user_pass.GetLength(), flag); | |
2016 if (m_bNewCrypto) { | 2015 if (m_bNewCrypto) { |
2017 delete m_pCryptoHandler; | 2016 delete m_pCryptoHandler; |
2018 } | 2017 } |
2019 m_pCryptoHandler = new CPDF_StandardCryptoHandler; | 2018 m_pCryptoHandler = new CPDF_StandardCryptoHandler; |
2020 m_pCryptoHandler->Init(m_pEncryptDict, &handler); | 2019 m_pCryptoHandler->Init(m_pEncryptDict, &handler); |
2021 m_bNewCrypto = TRUE; | 2020 m_bNewCrypto = TRUE; |
2022 m_bSecurityChanged = TRUE; | 2021 m_bSecurityChanged = TRUE; |
2023 } | 2022 } |
2024 } | 2023 } |
2025 } | 2024 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 m_bNewCrypto = FALSE; | 2069 m_bNewCrypto = FALSE; |
2071 if (!m_bStandardSecurity) { | 2070 if (!m_bStandardSecurity) { |
2072 return; | 2071 return; |
2073 } | 2072 } |
2074 if (m_pEncryptDict) { | 2073 if (m_pEncryptDict) { |
2075 m_pEncryptDict->Release(); | 2074 m_pEncryptDict->Release(); |
2076 m_pEncryptDict = NULL; | 2075 m_pEncryptDict = NULL; |
2077 } | 2076 } |
2078 m_bStandardSecurity = FALSE; | 2077 m_bStandardSecurity = FALSE; |
2079 } | 2078 } |
OLD | NEW |