diff --git a/ChangeLog b/ChangeLog index 3a53753d..e7af70d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -137,7 +137,7 @@ 2021-02-04 Jay Berkenbilt - * Add new option --pasword-file=file for reading the decryption + * Add new option --password-file=file for reading the decryption password from a file. file may be "-" to read from standard input. Fixes #499. diff --git a/TODO b/TODO index 3e5ee7bc..000b4f11 100644 --- a/TODO +++ b/TODO @@ -480,7 +480,7 @@ I find it useful to make reference to them in this list. encrypts, it never generates streams with explicit crypt filters. Prior to 10.2, there was an incorrect attempt to treat /EFF as a default value for decrypting file attachment streams, but it is not - supposed to mean that. Instead, it is intended for comforming + supposed to mean that. Instead, it is intended for conforming writers to obey this when adding new attachments. Qpdf is not a conforming writer in that respect. diff --git a/include/qpdf/QPDFEFStreamObjectHelper.hh b/include/qpdf/QPDFEFStreamObjectHelper.hh index fe960785..e7530b5d 100644 --- a/include/qpdf/QPDFEFStreamObjectHelper.hh +++ b/include/qpdf/QPDFEFStreamObjectHelper.hh @@ -41,7 +41,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper QPDF_DLL virtual ~QPDFEFStreamObjectHelper() = default; - // Date parameters are strings that comform to the PDF spec for + // Date parameters are strings that conform to the PDF spec for // date/time strings, which is "D:yyyymmddhhmmss" where is // either "Z" for UTC or "-hh'mm'" or "+hh'mm'" for timezone // offset. Examples: "D:20210207161528-05'00'", diff --git a/ispell-words b/ispell-words index 48e76a01..b5200336 100644 --- a/ispell-words +++ b/ispell-words @@ -25,15 +25,19 @@ ActiveState acyclic adbe addArrayElement +addArrayItem +AddAttachment addChoicesToCompletions addContentTokenFilter addDictionaryMember adde addExplicitElementsToList +addFormField addOptionsToCompletions addPage addPageAt addPageContents +addPathElement addr addTokenFilter addToTable @@ -50,9 +54,11 @@ AESv aesv afa afdh +afdhph ageneration AHx ai +aitems AIX alg alloc @@ -79,6 +85,8 @@ anyWarnings aobjid aoh ap +apcm +apdict apexcovantage api APIs @@ -96,7 +104,20 @@ appspot arandom ARCFOUR arg +argAACreationDate +argAADescription +argAAFilename +argAAKey +argAAMimeType +argAAModDate +argAApositional +argAAReplace +argAddAttachment +argAllowInsecure argc +argCApassword +argCApositional +argCAprefix argCheck argCheckLinearization argCoalesceContents @@ -105,6 +126,7 @@ argCompletionBash argCompletionZsh argCompressionLevel argCompressStreams +argCopyAttachments argCopyEncryption argCopyright argDecodeLevel @@ -113,6 +135,8 @@ argDeterministicId argEmpty argEncrypt argEncryptionFilePassword +argEndAddAttachment +argEndCopyAttachments argEndEncrypt argEndUnderOverlay argExternalizeInlineImages @@ -135,6 +159,7 @@ argKeepFilesOpenThreshold argKeepInlineImages argLinearize argLinearizePass +argListAttachments argMinVersion argNewlineBeforeEndstream argNoOriginalObjectIds @@ -149,6 +174,7 @@ argOverlay argPages ArgParser argPassword +argPasswordFile argPasswordIsHexKey argPasswordMode argPositional @@ -158,12 +184,14 @@ argProgress argQdf argRawStreamData argRecompressFlate +argRemoveAttachment argRemovePageLabels argRemoveUnreferencedResources argReplaceInput argRequiresPassword argRotate args +argShowAttachment argShowCrypto argShowEncryption argShowEncryptionKey @@ -223,6 +251,7 @@ assertType assignCompressedObjectNumbers atof atoi +att auth AuthEvent autobuilder @@ -236,6 +265,7 @@ autoload automake autotools ba +BA's backports backref backreference @@ -262,6 +292,7 @@ betweenTokens bf bi bidirectionally +binarySearch binmode bis BitsPerComponent @@ -286,6 +317,7 @@ bpr bpreserve brdp bs +bsearch BT btn buf @@ -301,6 +333,7 @@ bx ByteRange bytesNeeded ca +CA's calc calculateHOutline calculateHPageOffset @@ -323,6 +356,7 @@ CCITT CCITTFaxDecode cd cdc +cdef cdict ce cec @@ -351,6 +385,7 @@ checkPageContents checkSchema checkSchemaInternal checkSeen +CheckSum checkUnread CHGeneric chmod @@ -397,7 +432,11 @@ ColorToGray com commandline COMP +compareKeyItem +compareKeyKid +compareKeys compareVersions +compat compatbility completionCommon CompressConfig @@ -414,10 +453,15 @@ contentSize contrib convertIIDict CopiedStreamDataProvider +copyAnnotations +CopyAttachmentFrom copyEncryptionParameters +copyFieldsFromForeignPage copyForeign copyForeignObject copyObject +copyStream +copyStreamData cout CoVantage cp @@ -427,10 +471,13 @@ cplusplus cpp CPPFLAGS cr +createEFStream CreateFile +createFileSpec createPageContents createWhat CreationDate +creationdate cred cregex CRNL @@ -509,6 +556,7 @@ dep deque dereference dereferenced +desc dest DESTDIR destpage @@ -523,6 +571,7 @@ DeviceRGB DevOps DF dh +di DIAERESIS dict didier @@ -544,6 +593,7 @@ discardGeneration dist distclean distfiles +ditems dl dlfcn dll @@ -607,12 +657,18 @@ eded eeb eeee ef +efdh EFF efgh +efoh +efs +efsoh ei ejb +elem elif elt +EmbeddedFile EmbeddedFiles embeddedFiles emc @@ -693,6 +749,7 @@ ff FFFD ffff ffh +ffield fflush fghij fh @@ -701,6 +758,7 @@ fI fieldflags fieldtype fIinfilename +FileAttachment FileCloser fileinfo FileInputSource @@ -708,7 +766,9 @@ filemethod fileno filenow filep -Filespec +filesize +filespec +FileSpec FILETIME filetrailer filterability @@ -723,6 +783,7 @@ findEI findEndstream findFirst findHeader +findInternal findLast findObject findObjectAtOrBelow @@ -771,19 +832,23 @@ fR fr fread frs -FS +fs fsanitize fseek fseeki fseeko +fsoh fstream ftell ftelli ftello +ftype fullinfo fullname fullpad +fullpath func +FunctionProvider fuzzer fuzzers FuzzHelper @@ -832,10 +897,12 @@ getBitsInt getBitsSigned getBoolValue getBuffer +getChecksum getChoices getCompressibleObjects getCompressibleObjGens getCount +getCreationDate getCropBox getDA getDataChecksum @@ -850,6 +917,10 @@ getDestPage getDict getDictAsMap getElementsForShallowCopy +getEmbeddedFile +getEmbeddedFiles +getEmbeddedFileStream +getEmbeddedFileStreams getEncryptionKey getEncryptMetadata getenv @@ -863,6 +934,7 @@ getFieldType getFileChecksum GetFileInformationByHandle getFilename +getFilenames getFilePosition getFilterOnWrite getFinalVersion @@ -871,6 +943,7 @@ getFlags getFontFromResource getFontName getFormFields +getFormFieldsForPage getFormXObjectForPage getFormXObjects getFullyQualifiedName @@ -905,16 +978,20 @@ getLength getLengthBytes getLinearizationOffset getLinearizedParts +GetLocalTime getMappingName getMatch +getMatrixForFormXObjectPlacement getMatrixForTransformations getMax getMediaBox getMessageDetail getMin +getModDate getName getNeedAppearances getNext +getNextKid getNItems getNumericValue getO @@ -941,6 +1018,7 @@ getPaddedUserPassword getPageContentForAppearance getPageContents getPageImages +getParam getParent getParsedOffset getPartialName @@ -973,8 +1051,10 @@ getStringValue getSubtype GetSystemTime getTf +GetTimeZoneInformation getTitle getToken +getTopLevelField getTopLevelOutlines getTrailer getTrimBox @@ -1047,6 +1127,7 @@ handleToken hasAcroForm hasacroform hasDescription +hasEmbeddedFiles hasIndex hasKey hasName @@ -1066,6 +1147,7 @@ hexstrings hf HGeneric hh +hh'mm HighPart hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstn hlen @@ -1113,6 +1195,7 @@ ImageOptimizer ImageProvider img immediateCopyFrom +impl inbuf includeIgnorable incr @@ -1129,6 +1212,7 @@ infs ing inheritsresources init +initEmbeddedFiles initializeByPage initializeEncryption initializePipelineStack @@ -1147,6 +1231,8 @@ inpdf inputLen InputSource InsecureRandomDataProvider +insertAfter +insertFirst insertItem insertPage insertPageobjToPage @@ -1161,6 +1247,7 @@ ints inttypes inv invalidateCache +InvalidInputSource inverter io IOLBF @@ -1215,13 +1302,16 @@ isStream isString isText istext +istr istream istype isType italicseq itemizedlist +itemsKey iter ith +ivalue iz jarr JBIG @@ -1257,11 +1347,13 @@ keylen KEYLENGTH keyset KeyStream +keyValid kgdl LARGEFILE LastChar lastchar lastnum +lastPathElement lastreleased lastTokenWasBad latin @@ -1273,6 +1365,7 @@ LDFLAGS ldquo len lengthNextN +leq lexer LF lgtm @@ -1319,6 +1412,7 @@ LLVMFuzzerTestOneInput llx lly LocalFree +localtime logoWidth longjmp longlong @@ -1329,6 +1423,7 @@ LPSTR lqpdf lsb lt +ltime ltmain LTS lu @@ -1370,6 +1465,7 @@ maxval maybeReplace md mdash +mday MDd mediabox MediaBox @@ -1386,6 +1482,7 @@ messageBuffer metadata mgr MILLE +mimetype min mingw MinGW @@ -1397,11 +1494,14 @@ mk mkdir mkinstalldirs mklink +ModDate +moddate moddifyannotations modifyassembly modifyforms modifyother ModOther +mon monoseq mr MSC @@ -1418,6 +1518,8 @@ multithreaded Mutator mutators mv +NameTree +NameTreeDetails NameWatcher nannots nbackrefs @@ -1439,8 +1541,10 @@ newBool NewDict newdict newDictionary +newEmpty newFromMatrix newFromRectangle +newFromStream newIndirect newInlineImage newInteger @@ -1453,6 +1557,7 @@ newpage newpdf newReal newReserved +newSomething newStream newString newUnicodeString @@ -1461,6 +1566,7 @@ nFileIndexHigh nFileIndexLow nfirst ngrandkids +nh nitems nkids nl @@ -1468,9 +1574,15 @@ nlines nlohmann nmatches nMatches +NNTree +nntree +NNTreeDetails +NNTreeImpl +NNTreeIterator NoBackref nobjects nocase +noh NOMATCH NOMEMORY NONINFRINGEMENT @@ -1495,12 +1607,15 @@ nspaces nspecs nstream nstripes +NT NTE ntoh ntotal NUL nullptr num +NumberTree +NumberTreeDetails numericValue numrange nums @@ -1538,25 +1653,31 @@ odh odict oe OffsetInputSource +ofirst og ogs oi oiter okey ol +olast oldname oldpdf +olimits olist omap +omatrix onum ooh op opages +opath OpenAction openObject opensource openssl OpenSSL +opi optionalParameter OptionEntry ord @@ -1627,6 +1748,7 @@ parseUnderOverlayOptions parseVersion partialname partLen +PathElement pathsep patmv PatternFinder @@ -1671,7 +1793,7 @@ pipePageContents pipeStreamData pipeStreamData's pipeStringAndFinish -Pkey +pkey pkg PKI pl @@ -1699,6 +1821,8 @@ pre prebuilt precheck precompiled +preferredcontents +preferredname prefilering prefiltering prepareFileForWrite @@ -1748,6 +1872,7 @@ pushMD pushOutlinesToPart pushPipeline PUTU +pval PWD py pypi @@ -1777,19 +1902,27 @@ QPDF's QPDFAcroFormDocumentHelper QPDFAcroFormDocumentHelper's QPDFAnnotationObjectHelper +QPDFArrayItems qpdfbuild QPDFCONSTANTS QPDFCrypto QPDFCryptoImpl QPDFCryptoProvider +QPDFDictItems QPDFDocumentHelper +QPDFEFStreamObjectHelper +QPDFEmbeddedFileDocumentHelper QPDFExc QPDFFake QPDFFakeName +QPDFFileSpecObjectHelper QPDFFormFieldObjectHelper QPDFMatrix +QPDFMatrix's QPDFNameTreeObjectHelper +QPDFNameTreeObjectHelper's QPDFNumberTreeObjectHelper +QPDFNumberTreeObjectHelper's QPDFObject QPDFObjectHandle QPDFObjectHandle's @@ -1810,6 +1943,7 @@ QPDFSomethingObjectHelper QPDFStream QPDFStreamFilter QPDFSystemError +QPDFTime QPDFTokenizer QPDFTYPES QPDFVersion @@ -1826,6 +1960,7 @@ QStrings QTC qtest QTest +qtm quadding QuadPart quot @@ -1848,6 +1983,7 @@ rb rbegin rc rcon +rdicts RDONLY rdp rdpp @@ -1875,6 +2011,7 @@ recomputation recoverStreamLength rect refactor +refactored refcount refpage refpos @@ -1890,6 +2027,8 @@ Regsvr releaseResolved ReleaseResolver remotesensing +removeEmbeddedFile +removeFormFields removeKey removePage removereplace @@ -1898,6 +2037,7 @@ removeUnreferencedResourcesHelper ren repl replaceDict +replaceEmbeddedFile replaceFilterData replaceForeignIndirectObjects replaceKey @@ -1914,6 +2054,7 @@ resampler resave reserveObjects resetBits +resetLimits resolveLiteral resolveNamedDest resolveObjectsInStream @@ -1941,6 +2082,7 @@ rl rm rnd RNRT +RobK rollover rotatePage rotatex @@ -1976,6 +2118,7 @@ scp sdk sdp se +sec SecureRandomDataProvider sed seekable @@ -1994,6 +2137,7 @@ setCheckBoxValue setCompressionLevel setCompressStreams setContentNormalization +setCreationDate setDataKey setDecodeLevel setDecodeParms @@ -2013,6 +2157,7 @@ setFromVector setIgnoreXRefStreams setImmediateCopyFrom setItem +setItemNumber setIV setjmp setLastObjectDescription @@ -2021,6 +2166,7 @@ setLinearization setLinearizationPass setLineBuf setMinimumPDFVersion +setModDate setmode setNeedAppearances setNewlineBeforeEndstream @@ -2034,6 +2180,7 @@ setOutputFilename setOutputMemory setOutputPipeline setOutputStreams +setParam setParsedOffset setPasswordIsHexKey setPCLm @@ -2047,11 +2194,13 @@ setR setRadioButtonValue setRandomDataProvider setRecompressFlate +setSplitThreshold setStaticAesIV setStaticID setStreamDataMode setStreamDescription setStreamPrecheck +setSubtype setSuppressOriginalObjectIDs setSuppressWarnings setTrailer @@ -2120,6 +2269,7 @@ strcasecmp strchr strcmp strcpy +StreamCopier streamDataChoices StreamDataProvider streammethod @@ -2201,11 +2351,12 @@ tgen th thax thomas +throwException tiffcmp TIFFPredictor Tj TL -Tm +tm tmatrix tmp tnum @@ -2231,10 +2382,12 @@ toS toupper toUTF tp +tpi transcode transcoders transcodes transcoding +transformAnnotations transformRectangle traverseField travis @@ -2252,12 +2405,17 @@ ty typeinfo typename typeWarning +tz +tzinfo +tzset ubuntu uc uchar udata UE +uf uHHHH +uid uinow uint uiter @@ -2304,6 +2462,7 @@ uo upages upass updateAllPagesCache +updateIValue updateMap updateObjectMaps updateObjectMapsInternal @@ -2314,6 +2473,7 @@ urx ury usageExit UseAes +UseAttachments UseOutlines userPasswordMatched userpasswordmatched @@ -2323,6 +2483,7 @@ useZeroIV ushort USLetter usr +UTC utf Util utils @@ -2358,6 +2519,8 @@ wb wchar Wconversion wcslen +wDay +Wdeprecated Weimer werror wfilename @@ -2365,17 +2528,21 @@ wfilenamep WFLAGS wfopen whoami +wHour willFilterStream WinAnsi winansi WinAnsiEncoding wincrypt WindowsCryptProvider +withinLimits wlen wmain wmatrix +wMinute wmode wmodep +wMonth wnew wold wpath @@ -2408,6 +2575,7 @@ writeToken writeTrailer writeXRefStream writeXRefTable +wSecond wsetargv Wsign wunlink @@ -2415,6 +2583,7 @@ www wwwwwwwww WX wxWindows +wYear xA xa xABUL @@ -2483,6 +2652,7 @@ yscale yuiop YYYY yyyymmdd +yyyymmddhhmmss z's zalloc zarko diff --git a/libqpdf/NNTree.cc b/libqpdf/NNTree.cc index 61710032..2658ffe8 100644 --- a/libqpdf/NNTree.cc +++ b/libqpdf/NNTree.cc @@ -303,7 +303,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, // item. // In examples, for simplicity, /Nums is show to just contain - // numbers instead of pairs. Imagine this tre: + // numbers instead of pairs. Imagine this tree: // // root: << /Kids [ A B C D ] >> // A: << /Nums [ 1 2 3 4 ] >> diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index 78d3c5c7..1e4fe156 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -498,7 +498,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( // references. When we clone BA, we will want to clone A and // then update A's clone's kid to point B's clone and B's // clone's parent to point to A's clone. The same thing holds - // for annotatons. Next, when we get to CA, we will again + // for annotations. Next, when we get to CA, we will again // discover that A is the top, but we don't want to re-copy A. // We want CA's clone to be linked to the same clone as BA's. // Failure to do this will break up things like radio button diff --git a/libtests/qutil.cc b/libtests/qutil.cc index 7b1a8788..f52ec2dc 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -629,7 +629,7 @@ void timestamp_test() assert(QUtil::pdf_time_to_qpdf_time("D:20210211064743")); // Round trip on the current time without actually printing it. // Manual testing was done to ensure that we are actually getting - // back the current time in various timezones. + // back the current time in various time zones. assert(QUtil::pdf_time_to_qpdf_time( QUtil::qpdf_time_to_pdf_time( QUtil::get_current_qpdf_time()))); diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index ea52d6d3..5b1295c0 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -789,7 +789,7 @@ class ArgParser void argShowCrypto(); void argPositional(char* arg); void argPassword(char* parameter); - void argPasswordFile(char* paramter); + void argPasswordFile(char* parameter); void argEmpty(); void argLinearize(); void argEncrypt(); @@ -3709,7 +3709,7 @@ ArgParser::doFinalChecks() // the user password, so this lack of security is not an issue // for those files. Also we are consider only the ability to // open the file without a password to be insecure. We are not - // concerned about whether the viwer enforces security + // concerned about whether the viewer enforces security // settings when the user and owner password match. usage("A PDF with a non-empty user password and an empty owner" " password encrypted with a 256-bit key is insecure as it" @@ -5305,7 +5305,7 @@ static void add_attachments(QPDF& pdf, Options& o, int& exit_code) std::cerr << whoami << ": " << pdf.getFilename() << " already has an attachment with key = " << to_add.key << "; use --replace to replace" - << " or --key to specificy a different key" + << " or --key to specify a different key" << std::endl; exit_code = EXIT_ERROR; continue; diff --git a/qpdf/qtest/qpdf/add-attachments-duplicate.out b/qpdf/qtest/qpdf/add-attachments-duplicate.out index 48b2f5eb..7a5a51b4 100644 --- a/qpdf/qtest/qpdf/add-attachments-duplicate.out +++ b/qpdf/qtest/qpdf/add-attachments-duplicate.out @@ -1,2 +1,2 @@ -qpdf: a.pdf already has an attachment with key = auto-1; use --replace to replace or --key to specificy a different key +qpdf: a.pdf already has an attachment with key = auto-1; use --replace to replace or --key to specify a different key qpdf: wrote file b.pdf