diff options
author | Fabio D'Urso <fabiodurso@hotmail.it> | 2012-08-04 13:00:06 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2012-09-06 22:06:48 +0200 |
commit | 381be58e9e0d0e323acbd975a2334eca6d9018fd (patch) | |
tree | cbfb705dafaccf2723b9c6a5c1c0b85fd8647ac6 /utils | |
parent | 273e8c896e95b548093159dc8bb14d48ce447053 (diff) |
pdfinfo: Show info about the encryption algorithm
Diffstat (limited to 'utils')
-rw-r--r-- | utils/pdfinfo.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index d1c077bc..928d6619 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -246,11 +246,31 @@ int main(int argc, char *argv[]) { // print encryption info printf("Encrypted: "); if (doc->isEncrypted()) { - printf("yes (print:%s copy:%s change:%s addNotes:%s)\n", + Guchar *fileKey; + CryptAlgorithm encAlgorithm; + int keyLength; + doc->getXRef()->getEncryptionParameters(&fileKey, &encAlgorithm, &keyLength); + + const char *encAlgorithmName = "unknown"; + switch (encAlgorithm) + { + case cryptRC4: + encAlgorithmName = "RC4"; + break; + case cryptAES: + encAlgorithmName = "AES"; + break; + case cryptAES256: + encAlgorithmName = "AES-256"; + break; + } + + printf("yes (print:%s copy:%s change:%s addNotes:%s algorithm:%s)\n", doc->okToPrint(gTrue) ? "yes" : "no", doc->okToCopy(gTrue) ? "yes" : "no", doc->okToChange(gTrue) ? "yes" : "no", - doc->okToAddNotes(gTrue) ? "yes" : "no"); + doc->okToAddNotes(gTrue) ? "yes" : "no", + encAlgorithmName); } else { printf("no\n"); } |