Building extensions without entering the security key pass code

Mike Bray (Quote Loader Author)'s Avatar

Mike Bray (Quote Loader Author)

18 Feb, 2022 02:02 PM

Is it possible to set the security pass code within a build file so that I do not need to enter the pass code everytime I build an extension?

  1. 1 Posted by Dan P on 18 Feb, 2022 02:22 PM

    Dan P's Avatar

    Mike,
    Another user here:
    I tried many times a few years ago and never could find a way. I even asked the developer and he said he had no way to suggest (at that time). Been a few years.
    I was using Eclipse at the time but I now use IntelliJ. Haven't found a way.

    Hopefully, someone can tell us how!

  2. 2 Posted by Stuart Beesley ... on 18 Feb, 2022 02:23 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Which pass code? Do you mean to sign the mxt or do u mean to logon to a MD dataset?

  3. 3 Posted by Mike Bray (Quot... on 18 Feb, 2022 03:32 PM

    Mike Bray (Quote Loader Author)'s Avatar

    Stuart, the passcode you enter when adding the sign to the mxt. It is the code you create when creating the keys.

  4. 4 Posted by Stuart Beesley ... on 18 Feb, 2022 03:43 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    This may not help but I use a shell script to build my mxt files and I feed the code in via a redirect from a text file.

    I did try automating in Ant via IntelliJ but I just ended up with a locked screen that was awaiting input from nowhere.

  5. Support Staff 5 Posted by Sean Reilly on 18 Feb, 2022 04:57 PM

    Sean Reilly's Avatar

    The MoneyPie extension seems to have built-in a class to do this:
      https://github.com/TheInfiniteKind/moneydance_open/blob/main/src/com/moneydance/modules/features/moneyPie/SignMxt.java

    I've not tried it myself, but it might help. In general we really do need a way to automate this built-in to the signing tool.

    --
    Sean Reilly
    Director/Developer, The Infinite Kind
    infinitekind.com

  6. 6 Posted by Mike Bray (Quot... on 19 Feb, 2022 11:26 AM

    Mike Bray (Quote Loader Author)'s Avatar

    Thanks Sean

    This fix redirects Standard input stream to a file containing the
    passcode. On the surface it should work. I don't know if it is possible
    to add another parameter to KeyAdmin that takes the passcode and passes
    through to the code that asks for the passcode.

    I will experiment with the fix.
    Mike

  7. 7 Posted by Mike Bray (Quot... on 19 Feb, 2022 01:31 PM

    Mike Bray (Quote Loader Author)'s Avatar

    Based on the fix from Moneypie I have got this working. The fix as written does not work, it relies on redirecting standard in to a file. KeyAdmin uses a Console so this does not work, however, if you read the passcode and set the System property "moneydance_key_pass" to the pass code KeyAdmin reads this instead of from Standard In.

    Here is the amended code for the fix:

    import com.moneydance.admin.KeyAdmin;
    import java.io.FileInputStream;
    import java.io.File;
    import java.io.FileNotFoundException;
    public class SignMxt {
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            try
            {
                FileInputStream fis = new FileInputStream(new File("sign_pw.txt"));
                String code="";
                int content;
                while ((content=fis.read())!=-1) {
                    code +=(char)content;
                }
                System.setProperty("moneydance_key_pass",code);
                System.setIn(fis);
                KeyAdmin.main(args);
            }
            catch (FileNotFoundException fnfe)
            {
                System.out.println(fnfe.getMessage());
            }
            catch (Exception ex)
            {
                System.out.println(ex.getMessage());
            }
        }
    }
    
    Enclosed is a jar, copy the jar to your lib directory and change your build.xml to include:
         <pathelement path="${lib}/signmxt.jar"/>
    
    change your build file to use SignMxt instead of KeyAdmin
         <java newenvironment="true" classpathref="classpath" classname="SignMxt">
                <arg value="signextjar" />
                <arg value="${privkeyfile}" />
                <arg value="${privkeyid}" />
                <arg value="reportwriter2" />
                <arg line="${dist}/reportwriter2.mxt" />
            </java>
    
    Create a file called "sign_pw.txt" containing your passcode in your src directory.
  8. 8 Posted by Dan P on 19 Feb, 2022 02:59 PM

    Dan P's Avatar

    Thanks Mike! It works perfectly.
    I would note this. I originally put the passcode in a text file with a carriage return. That caused a padding error in the build. Removing the carriage return works fine.

  9. 9 Posted by Dan P on 20 Feb, 2022 04:07 PM

    Dan P's Avatar

    FWIW, I modified your code slightly to accommodate people like me who enter a carriage return after the passcode.

            while ((content=fis.read())!=-1) {
                if (content > 31) {
                    code += (char) content;
                }
            }
    

    Thoughts?

  10. 10 Posted by Mike Bray (Quot... on 21 Feb, 2022 06:04 AM

    Mike Bray (Quote Loader Author)'s Avatar

    Looks good, also I can remove the redirection of System.setIn

  11. 11 Posted by Mike Bray (Quot... on 23 Feb, 2022 01:43 PM

    Mike Bray (Quote Loader Author)'s Avatar

    I have updated the jar based on Dan's suggestion. This now accepts cr at the end of the line

  12. 12 Posted by patriciajoglesb... on 04 Mar, 2022 05:00 AM

    patriciajoglesby's Avatar

    How can I build extensions without entering the security pass code?

    Extensions are software programs designed to extend the functionality of other applications. They allow users to add features that may not otherwise be possible (or at least easy) to achieve through traditional means. In order to build custom software using extensions, they first need to be installed on your device. Extensions can then be created from any standard web browser. Once installed, the extensions can be added to any application simply by tapping the extension icon. To remove an extension, tap the app name once again, this time holding down the home button until a pop-up menu appears. Select ‘Remove’ and it should uninstall. Once you've removed them, the icons should disappear from your Home screen. You'll still have to enter the security passcode each time you want access to those apps, though.

  13. 13 Posted by Dan P on 04 Mar, 2022 02:31 PM

    Dan P's Avatar

    I think you might be confusing browser extensions with Moneydance extensions. Two different processes.

  14. System closed this discussion on 03 Jun, 2022 02:40 PM.

  15. Stuart Beesley (Mr Toolbox) re-opened this discussion on 24 Mar, 2023 06:50 PM

  16. 14 Posted by Stuart Beesley ... on 24 Mar, 2023 06:50 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    OK, just looked into this... Sorry to ask a daft question, but why not just set:
    keypass=
    into the file ./src/user.properties ?
    I just tried it, and the standard build.xml works using this.
    Thoughts?

  17. 15 Posted by Dan P on 24 Mar, 2023 08:17 PM

    Dan P's Avatar

    I don't follow. Where is user.properties used? In the build file?

  18. 16 Posted by Stuart Beesley ... on 24 Mar, 2023 08:40 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    The std build.xml file loads user.properties (and its variables). It then puts keypass into a system property which is read by the std signing jar/process. In fact, Mike’s jar basically does the same and sets the very same system property to achieve the same result. So as far as I can see, it’s already possible and works for me.

  19. 17 Posted by Dan P on 24 Mar, 2023 10:09 PM

    Dan P's Avatar

    I guess I'm the daft one. It doesn't work for me. Could I have user.preferences in the wrong place? It's in the directory where the build file is.

  20. 18 Posted by Stuart Beesley ... on 24 Mar, 2023 10:18 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Are you using a build file based on this one?

    https://github.com/TheInfiniteKind/moneydance_open/blob/main/src/bu...

    Take a look and you will see user.properties and also keypass= sections.

    ??

  21. 19 Posted by Dan P on 24 Mar, 2023 10:57 PM

    Dan P's Avatar

    I'm still using variations of the original build file from the developers package.
    I added the user.properties file and the keypass entries and it works for me too.
    Your solution is a lot easier but I've already put Mike's solution in the build files I use.
    I'll need to start the process of reviewing all the build files.
    Thanks!

  22. System closed this discussion on 23 Jun, 2023 11:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac