| 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_parser/cpdf_security_handler.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" |
| 8 | 8 |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| 11 #include "core/fdrm/crypto/fx_crypt.h" | 11 #include "core/fdrm/crypto/fx_crypt.h" |
| 12 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" |
| 12 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" | 13 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" |
| 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 14 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" |
| 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 15 #include "core/fpdfapi/fpdf_parser/cpdf_object.h" |
| 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" | 16 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" |
| 16 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" | |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const uint8_t defpasscode[32] = { | 20 const uint8_t defpasscode[32] = { |
| 21 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, | 21 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, |
| 22 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, | 22 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, |
| 23 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a}; | 23 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a}; |
| 24 | 24 |
| 25 void CalcEncryptKey(CPDF_Dictionary* pEncrypt, | 25 void CalcEncryptKey(CPDF_Dictionary* pEncrypt, |
| 26 const uint8_t* password, | 26 const uint8_t* password, |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 buf[11] = 'b'; | 690 buf[11] = 'b'; |
| 691 uint8_t* aes = FX_Alloc(uint8_t, 2048); | 691 uint8_t* aes = FX_Alloc(uint8_t, 2048); |
| 692 CRYPT_AESSetKey(aes, 16, key, 32, TRUE); | 692 CRYPT_AESSetKey(aes, 16, key, 32, TRUE); |
| 693 uint8_t iv[16], buf1[16]; | 693 uint8_t iv[16], buf1[16]; |
| 694 FXSYS_memset(iv, 0, 16); | 694 FXSYS_memset(iv, 0, 16); |
| 695 CRYPT_AESSetIV(aes, iv); | 695 CRYPT_AESSetIV(aes, iv); |
| 696 CRYPT_AESEncrypt(aes, buf1, buf, 16); | 696 CRYPT_AESEncrypt(aes, buf1, buf, 16); |
| 697 FX_Free(aes); | 697 FX_Free(aes); |
| 698 pEncryptDict->SetStringFor("Perms", CFX_ByteString(buf1, 16)); | 698 pEncryptDict->SetStringFor("Perms", CFX_ByteString(buf1, 16)); |
| 699 } | 699 } |
| OLD | NEW |