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 <time.h> | 7 #include <time.h> |
8 #include "../../../include/fpdfapi/fpdf_parser.h" | 8 #include "../../../include/fpdfapi/fpdf_parser.h" |
9 #include "../../../include/fdrm/fx_crypt.h" | 9 #include "../../../include/fdrm/fx_crypt.h" |
10 const FX_BYTE defpasscode[32] = { | 10 const FX_BYTE defpasscode[32] = { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, ke
y_len); | 100 return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, ke
y_len); |
101 } | 101 } |
102 FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() | 102 FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() |
103 { | 103 { |
104 return m_Permissions; | 104 return m_Permissions; |
105 } | 105 } |
106 static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, FX_BSTR name, int&
cipher, int& keylen) | 106 static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, FX_BSTR name, int&
cipher, int& keylen) |
107 { | 107 { |
108 int Version = pEncryptDict->GetInteger(FX_BSTRC("V")); | 108 int Version = pEncryptDict->GetInteger(FX_BSTRC("V")); |
109 int Revision = pEncryptDict->GetInteger(FX_BSTRC("R")); | |
110 cipher = FXCIPHER_RC4; | 109 cipher = FXCIPHER_RC4; |
111 keylen = 0; | 110 keylen = 0; |
112 if (Version >= 4) { | 111 if (Version >= 4) { |
113 CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict(FX_BSTRC("CF")); | 112 CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict(FX_BSTRC("CF")); |
114 if (pCryptFilters == NULL) { | 113 if (pCryptFilters == NULL) { |
115 return FALSE; | 114 return FALSE; |
116 } | 115 } |
117 if (name == FX_BSTRC("Identity")) { | 116 if (name == FX_BSTRC("Identity")) { |
118 cipher = FXCIPHER_NONE; | 117 cipher = FXCIPHER_NONE; |
119 } else { | 118 } else { |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 m_pAESContext = NULL; | 950 m_pAESContext = NULL; |
952 m_Cipher = FXCIPHER_NONE; | 951 m_Cipher = FXCIPHER_NONE; |
953 m_KeyLen = 0; | 952 m_KeyLen = 0; |
954 } | 953 } |
955 CPDF_StandardCryptoHandler::~CPDF_StandardCryptoHandler() | 954 CPDF_StandardCryptoHandler::~CPDF_StandardCryptoHandler() |
956 { | 955 { |
957 if (m_pAESContext) { | 956 if (m_pAESContext) { |
958 FX_Free(m_pAESContext); | 957 FX_Free(m_pAESContext); |
959 } | 958 } |
960 } | 959 } |
OLD | NEW |