7 Replies Latest reply on Jun 12, 2017 10:10 AM by Joel_Geraci

    expire code

    pdfUser1 Level 1

      Can someone please help me with this question? I am using this code to expire the document on a specific day and year. What occurred to me and is the reason I'm asking this question, can this script be modified to expire on a specific day and year but also expire on any date prior and any date passed the specific date. Example, to expire on December 25, 2017. If the user tries to change their computer's calendar to, let's say, 2016 the document would still expire.

       

      This is the script I'm using and works ok, but I'd like to modify it to make it more difficult to bypass even if the user turns off "Enable Javascript" or sets their computer back.

       

      function Expire()

      {

      // Get the current date and time

      var rightNow = new Date();

      // Setup End Date

      var rightNow = new Date();

      var beginDate = new Date("March 21, 2016 06:15:00 AM");

      var endDate = new Date("March 31, 2017 1:57:00 PM");

       

      this.closeDoc(true)

      }

      }

       

      // execute check expiration code

      Expire();

        • 1. Re: expire code
          Joel_Geraci Adobe Community Professional

          You can't solve this problem with JavaScript.

           

          The user will still be able to open the document in just about any PDF viewer other than Acrobat or Reader and only in the desktop version of those, the mobile Reader doesn't have closeDoc(). You're going to need some sort of encryption that pings a server for the time before decrypting the document.

          • 2. Re: expire code
            Bernd Alheit Adobe Community Professional & MVP

            Look for DRM solution.

            • 3. Re: expire code
              JR_Boulay Adobe Community Professional

              JavaScript can help you but you need to reverse the method: your document must be usable if and only if JavaScript is enabled.

              Example: add a layer or a field that cover all the layout on each page, and make JavaScript hidding it at document opening, so: no JavaScript = no document.

               

              • 4. Re: expire code
                Joel_Geraci Adobe Community Professional

                But layers can easily be hidden in alternative viewers that don't support JavaScript or when JavaScript is turned off.

                • 5. Re: expire code
                  JR_Boulay Adobe Community Professional

                  Sure, it's not bulletproof but it's cheaper than DRM ;-)

                  • 6. Re: expire code
                    Thom Parker Level 3

                    I'm with JR on this one.  True DRM is expensive and unwieldy. The OCG solution is cheap, easy, and cracking it is beyond the technical abilities of nearly all users. I have customers that uses this technique with documents they sell.  So it really works. I've got a demo file that provides detailed instructions on my site.

                     

                    However, it does fall in to the category of keeping honest users honest. Rather than preventing malicious users from accessing the PDF. Toward this end the solution can be made stronger by also encrypting the PDF with a self signed certificate from the target user.

                     

                    I think this is a pretty good combination, blocking OCG Layer and digital certificate encryption.

                    • 7. Re: expire code
                      Joel_Geraci Adobe Community Professional

                      Thom is correct in that the solution does work to keep honest people honest... I just have a far dimmer view of humanity. It really comes down to how secure do you need the security to be.