Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp |
index 9f356a47483d2fb658433dadaa15e15547ad0102..128c561bada6b2be71b2837c8f06404c6a21e9fb 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp |
@@ -24,12 +24,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, FX_DWORD |
uint8_t md5[100]; |
CRYPT_MD5Start(md5); |
CRYPT_MD5Update(md5, passcode, 32); |
- CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); |
+ CFX_ByteString okey = pEncrypt->GetStringAt("O"); |
CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength()); |
FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P")); |
CRYPT_MD5Update(md5, (uint8_t*)&perm, 4); |
if (pIdArray) { |
- CFX_ByteString id = pIdArray->GetString(0); |
+ CFX_ByteString id = pIdArray->GetStringAt(0); |
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); |
} |
if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) { |
@@ -133,7 +133,7 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStrin |
nKeyBits *= 8; |
} |
keylen = nKeyBits / 8; |
- CFX_ByteString cipher_name = pDefFilter->GetString(FX_BSTRC("CFM")); |
+ CFX_ByteString cipher_name = pDefFilter->GetStringAt("CFM"); |
if (cipher_name == FX_BSTRC("AESV2") || cipher_name == FX_BSTRC("AESV3")) { |
cipher = FXCIPHER_AES; |
} |
@@ -156,8 +156,8 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) |
if (m_Version < 4) { |
return _LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen); |
} |
- CFX_ByteString stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF")); |
- CFX_ByteString strf_name = pEncryptDict->GetString(FX_BSTRC("StrF")); |
+ CFX_ByteString stmf_name = pEncryptDict->GetStringAt("StmF"); |
+ CFX_ByteString strf_name = pEncryptDict->GetStringAt("StrF"); |
if (stmf_name != strf_name) { |
return FALSE; |
} |
@@ -175,8 +175,8 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX |
m_Permissions = pEncryptDict->GetInteger(FX_BSTRC("P"), -1); |
CFX_ByteString strf_name, stmf_name; |
if (m_Version >= 4) { |
- stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF")); |
- strf_name = pEncryptDict->GetString(FX_BSTRC("StrF")); |
+ stmf_name = pEncryptDict->GetStringAt("StmF"); |
+ strf_name = pEncryptDict->GetStringAt("StrF"); |
if (stmf_name != strf_name) { |
return FALSE; |
} |
@@ -291,11 +291,13 @@ void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt, |
FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size, |
FX_BOOL bOwner, uint8_t* key) |
{ |
- CFX_ByteString okey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("O")) : CFX_ByteString(); |
+ CFX_ByteString okey = m_pEncryptDict ? |
+ m_pEncryptDict->GetStringAt("O") : CFX_ByteString(); |
if (okey.GetLength() < 48) { |
return FALSE; |
} |
- CFX_ByteString ukey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("U")) : CFX_ByteString(); |
+ CFX_ByteString ukey = m_pEncryptDict ? |
+ m_pEncryptDict->GetStringAt("U") : CFX_ByteString(); |
if (ukey.GetLength() < 48) { |
return FALSE; |
} |
@@ -330,7 +332,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo |
} |
CRYPT_SHA256Finish(sha, digest); |
} |
- CFX_ByteString ekey = m_pEncryptDict ? m_pEncryptDict->GetString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE")) : CFX_ByteString(); |
+ CFX_ByteString ekey = m_pEncryptDict ? |
+ m_pEncryptDict->GetStringAt(bOwner ? "OE" : "UE") : CFX_ByteString(); |
if (ekey.GetLength() < 32) { |
return FALSE; |
} |
@@ -342,7 +345,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo |
CRYPT_AESDecrypt(aes, key, ekey, 32); |
CRYPT_AESSetKey(aes, 16, key, 32, FALSE); |
CRYPT_AESSetIV(aes, iv); |
- CFX_ByteString perms = m_pEncryptDict->GetString(FX_BSTRC("Perms")); |
+ CFX_ByteString perms = m_pEncryptDict->GetStringAt("Perms"); |
if (perms.IsEmpty()) { |
return FALSE; |
} |
@@ -390,7 +393,8 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, |
{ |
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta, |
m_pParser->GetIDArray()); |
- CFX_ByteString ukey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("U")) : CFX_ByteString(); |
+ CFX_ByteString ukey = m_pEncryptDict ? |
+ m_pEncryptDict->GetStringAt("U") : CFX_ByteString(); |
if (ukey.GetLength() < 16) { |
return FALSE; |
} |
@@ -418,7 +422,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, |
CRYPT_MD5Update(md5, defpasscode, 32); |
CPDF_Array* pIdArray = m_pParser->GetIDArray(); |
if (pIdArray) { |
- CFX_ByteString id = pIdArray->GetString(0); |
+ CFX_ByteString id = pIdArray->GetStringAt(0); |
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); |
} |
CRYPT_MD5Finish(md5, ukeybuf); |
@@ -435,7 +439,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owne |
} |
CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size, int32_t key_len) |
{ |
- CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O")); |
+ CFX_ByteString okey = m_pEncryptDict->GetStringAt("O"); |
uint8_t passcode[32]; |
FX_DWORD i; |
for (i = 0; i < 32; i ++) { |
@@ -565,7 +569,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ |
CRYPT_MD5Start(md5); |
CRYPT_MD5Update(md5, defpasscode, 32); |
if (pIdArray) { |
- CFX_ByteString id = pIdArray->GetString(0); |
+ CFX_ByteString id = pIdArray->GetStringAt(0); |
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); |
} |
uint8_t digest[32]; |
@@ -600,7 +604,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD |
CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5); |
uint8_t digest[20]; |
CRYPT_SHA1Finish(sha, digest); |
- CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U")); |
+ CFX_ByteString ukey = pEncryptDict->GetStringAt("U"); |
uint8_t digest1[48]; |
if (m_Revision >= 6) { |
Revision6_Hash(password, size, digest, (bOwner ? (const uint8_t*)ukey : NULL), digest1); |