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/include/fx_crypt.h" | 11 #include "core/fdrm/crypto/fx_crypt.h" |
12 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" | 12 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" |
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
15 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" | 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" |
16 #include "core/fpdfapi/fpdf_parser/include/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, |
(...skipping 668 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 |