Ignore:
Timestamp:
2024-10-28T19:18:41+01:00 (4 months ago)
Author:
taylor.smock
Message:

Dependency updates

Most plugins have been moved to require a minimum version of r19044 (mostly for
Java 11+ build reasons).

Location:
applications/editors/josm/plugins/trustosm
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/trustosm/build.xml

    r35978 r36349  
    55    <property name="commit.message" value="trustosm: recompile for compatibility with JOSM r17896" />
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="18494"/>
     7    <property name="plugin.main.version" value="19044"/>
    88    <property name="plugin.author" value="Christoph Wagner" />
    99    <property name="plugin.class" value="org.openstreetmap.josm.plugins.trustosm.TrustOSMplugin" />
     
    2222        <include name="plastic_laf.jar"/>
    2323    </fileset>
    24     <!-- create a property containing all .jar files, prefix lib/, and seperated with a space -->
    25     <pathconvert property="libs.project" pathsep=" ">
    26         <mapper>
    27             <chainedmapper>
    28                 <!-- remove absolute path -->
    29                 <flattenmapper/>
    30                 <!-- add lib/ prefix -->
    31                 <globmapper from="*" to="${ant.project.name}/lib/*"/>
    32             </chainedmapper>
    33         </mapper>
    34         <path>
    35             <!-- plugin.lib.dir contains all jar files -->
    36             <fileset dir="${plugin.lib.dir}">
    37                 <include name="**/*.jar"/>
    38                 <exclude name="**/*-sources.jar"/>
    39                 <exclude name="**/*-javadoc.jar"/>
    40             </fileset>
    41         </path>
    42     </pathconvert>
    43     <!-- additional entry in manifest -->
    44     <target name="additional-manifest">
    45         <manifest file="MANIFEST" mode="update">
    46             <attribute name="Class-Path" value="${libs.project}"/>
    47         </manifest>
    48     </target>
    49     <!--
    50     **********************************************************
    51     ** setup-dist - copies files for distribution
    52     **********************************************************
    53     -->
    54     <target name="setup-dist">
    55         <antcall target="setup-dist-default" />
    56         <copy todir="${plugin.build.dir}/lib">
    57             <fileset dir="${plugin.lib.dir}"/>
    58         </copy>
    59     </target>
    60     <!--
    61     **********************************************************
    62     ** dist - creates the plugin jar
    63     **********************************************************
    64     -->
    65     <target name="dist" depends="compile,revision">
    66         <echo message="creating ${ant.project.name}.jar ... "/>
    67         <antcall target="setup-dist" />
    68         <delete file="MANIFEST" failonerror="no"/>
    69         <manifest file="MANIFEST" mode="update">
    70             <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    71             <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    72             <attribute name="Plugin-Class" value="${plugin.class}" />
    73             <attribute name="Plugin-Description" value="${plugin.description}" />
    74             <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
    75             <attribute name="Author" value="${plugin.author}"/>
    76         </manifest>
    77         <antcall target="add-manifest-attribute">
    78             <param name="manifest.attribute" value="Plugin-Link"/>
    79             <param name="property.name" value="plugin.link"/>
    80             <param name="property.value" value="${plugin.link}"/>
    81         </antcall>
    82         <antcall target="add-manifest-attribute">
    83             <param name="manifest.attribute" value="Plugin-Icon"/>
    84             <param name="property.name" value="plugin.icon"/>
    85             <param name="property.value" value="${plugin.icon}"/>
    86         </antcall>
    87         <antcall target="add-manifest-attribute">
    88             <param name="manifest.attribute" value="Plugin-Early"/>
    89             <param name="property.name" value="plugin.early"/>
    90             <param name="property.value" value="${plugin.early}"/>
    91         </antcall>
    92         <antcall target="add-manifest-attribute">
    93             <param name="manifest.attribute" value="Plugin-Requires"/>
    94             <param name="property.name" value="plugin.requires"/>
    95             <param name="property.value" value="${plugin.requires}"/>
    96         </antcall>
    97         <antcall target="add-manifest-attribute">
    98             <param name="manifest.attribute" value="Plugin-Stage"/>
    99             <param name="property.name" value="plugin.stage"/>
    100             <param name="property.value" value="${plugin.stage}"/>
    101         </antcall>
    102         <antcall target="additional-manifest" />
    103         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifest="MANIFEST" manifestencoding="UTF-8"/>
    104         <delete file="MANIFEST" failonerror="no"/>
    105         <antcall target="post-dist" />
     24
     25    <target name="pre-compile" depends="fetch_dependencies">
     26        <!-- include fetch_dependencies task -->
    10627    </target>
    10728</project>
  • applications/editors/josm/plugins/trustosm/pom.xml

    r36325 r36349  
    1616    <properties>
    1717        <plugin.src.dir>src</plugin.src.dir>
    18         <plugin.main.version>18494</plugin.main.version>
     18        <plugin.main.version>19044</plugin.main.version>
    1919        <plugin.author>Christoph Wagner</plugin.author>
    2020        <plugin.class>org.openstreetmap.josm.plugins.trustosm.TrustOSMplugin</plugin.class>
     
    2727        <dependency>
    2828            <groupId>org.bouncycastle</groupId>
    29             <artifactId>bcpg-jdk15on</artifactId>
    30             <version>1.51</version>
     29            <artifactId>bcpg-jdk18on</artifactId>
     30            <version>1.78.1</version>
    3131        </dependency>
    3232        <dependency>
  • applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java

    r34599 r36349  
    77import java.awt.Dimension;
    88import java.awt.GridBagLayout;
    9 import java.awt.event.ActionEvent;
    10 import java.awt.event.ActionListener;
    119import java.awt.event.ComponentAdapter;
    1210import java.awt.event.ComponentEvent;
     
    1513import java.io.FileOutputStream;
    1614import java.io.IOException;
    17 import java.nio.charset.Charset;
    1815import java.nio.charset.StandardCharsets;
    1916import java.security.KeyPair;
     
    106103    private PGPSecretKeyRingCollection pgpSec;
    107104    private PGPPublicKeyRingCollection pgpPub;
    108     private static int digest = PGPUtil.SHA1;
     105    private static final int digest = PGPUtil.SHA1;
    109106    private PGPSecretKey pgpSecKey;
    110107    public boolean keepkey = false;
     
    122119
    123120    public PGPPublicKey getPublicKeyFromRing(long keyID) {
    124         try {
    125             if (pgpPub.contains(keyID))
    126                 return pgpPub.getPublicKey(keyID);
    127             else if (pgpSec.contains(keyID))
    128                 return pgpSec.getSecretKey(keyID).getPublicKey();
    129         } catch (PGPException e) {
    130             System.err.println("Could not read a PGPPublic key from your KeyRingCollectionFile. Stacktrace:");
    131             e.printStackTrace();
     121        if (pgpPub.contains(keyID)) {
     122            return pgpPub.getPublicKey(keyID);
     123        } else if (pgpSec.contains(keyID)) {
     124            return pgpSec.getSecretKey(keyID).getPublicKey();
    132125        }
    133126        return null;
     
    216209        JButton detailsButton = new JButton(tr("Details"), ImageProvider.get("keydetails"));
    217210        detailsButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    218         detailsButton.addActionListener(new ActionListener() {
    219             @Override
    220             public void actionPerformed(ActionEvent arg0) {
    221                 PGPSecretKey sk = sigKeys.get(keyBox.getSelectedIndex());
    222                 showKeyDetails(getPublicKeyFromRing(sk.getKeyID()));
    223             } });
     211        detailsButton.addActionListener(arg0 -> {
     212            PGPSecretKey sk = sigKeys.get(keyBox.getSelectedIndex());
     213            showKeyDetails(getPublicKeyFromRing(sk.getKeyID()));
     214        });
    224215        p.add(detailsButton);
    225216
     
    232223        JButton createButton = new JButton(tr("Create new Key"), ImageProvider.get("key"));
    233224        createButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    234         createButton.addActionListener(new ActionListener() {
    235 
    236             @Override
    237             public void actionPerformed(ActionEvent arg0) {
    238                 try {
    239                     PGPSecretKey secKey = generateKey();
    240                     if (secKey != null) {
    241                         keyBox.addItem(secKeytoString(secKey));
    242                         sigKeys.add(secKey);
    243                     }
    244                 } catch (NoSuchAlgorithmException | NoSuchProviderException | PGPException | IOException e) {
    245                     Logging.error(e);
     225        createButton.addActionListener(arg0 -> {
     226            try {
     227                PGPSecretKey secKey = generateKey();
     228                if (secKey != null) {
     229                    keyBox.addItem(secKeytoString(secKey));
     230                    sigKeys.add(secKey);
    246231                }
    247             } });
     232            } catch (NoSuchAlgorithmException | NoSuchProviderException | PGPException | IOException e) {
     233                Logging.error(e);
     234            }
     235        });
    248236        p.add(createButton);
    249237        p.add(Box.createRigidArea(d));
     
    265253    }
    266254
    267     public void readGpgFiles() throws PGPException, IOException, NoSuchAlgorithmException, NoSuchProviderException {
     255    public void readGpgFiles() throws PGPException, IOException {
    268256        FileInputStream pubIn;
    269257        FileInputStream secIn;
     
    283271    }
    284272
    285     public void writeGpgFiles() throws FileNotFoundException, IOException {
     273    public void writeGpgFiles() throws IOException {
    286274        String path = Preferences.main().getPluginsDirectory().getPath();
    287275        try (FileOutputStream pubOut = new FileOutputStream(path + "/trustosm/gnupg/pubring.gpg");
     
    450438     */
    451439    public static double searchTolerance(PGPSignature sig) {
    452         /** Take the first NotationData packet that seems to have Tolerance information */
     440        /* Take the first NotationData packet that seems to have Tolerance information */
    453441        for (NotationData nd : sig.getHashedSubPackets().getNotationDataOccurrences()) {
    454442            if (nd.getNotationName().equals(TrustGPG.NOTATION_DATA_KEY)) {
     
    470458
    471459        JFormattedTextField meters = new JFormattedTextField(NumberFormat.getNumberInstance());
    472         meters.setValue(Double.valueOf(10));
     460        meters.setValue(10.0);
    473461        meters.setColumns(5);
    474462
     
    480468
    481469        if (n == JOptionPane.OK_OPTION) {
    482             spGen.setNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, "Tolerance:"+meters.getValue()+"m");
     470            spGen.addNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, "Tolerance:" + meters.getValue() + "m");
    483471            return spGen;
    484472        }
     
    512500            if (web.isSelected()) sources += ":web";
    513501            if (trusted.isSelected()) sources += ":trusted";
    514             spGen.setNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, sources);
     502            spGen.addNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, sources);
    515503            return spGen;
    516504        }
     
    548536            Iterator<?> it = pgpSecKey.getPublicKey().getUserIDs();
    549537            if (it.hasNext()) {
    550                 spGen.setSignerUserID(false, (String) it.next());
     538                spGen.addSignerUserID(false, (String) it.next());
    551539            }
    552540            sGen.setHashedSubpackets(spGen.generate());
    553             sGen.update(tosign.getBytes(Charset.forName("UTF-8")));
     541            sGen.update(tosign.getBytes(StandardCharsets.UTF_8));
    554542            sig = sGen.generate();
    555543            //System.out.println(new String(sGen.generateOnePassVersion(false).getEncoded(),Charset.forName("UTF-8")));
     
    586574            PGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider().setProvider(provider);
    587575            sig.init(contentVerifierBuilderProvider, pgpPub.getPublicKey(sig.getKeyID()));
    588             sig.update(sigtext.getBytes(Charset.forName("UTF-8")));
     576            sig.update(sigtext.getBytes(StandardCharsets.UTF_8));
    589577            return sig.verify();
    590578        } catch (Exception e) {
     
    630618        String keyid = "0x"+Long.toHexString(key.getKeyID()).substring(8).toUpperCase(Locale.ENGLISH);
    631619
    632         String algorithm = "";
     620        final String algorithm;
    633621        int algo = key.getAlgorithm();
    634622        switch(algo) {
     
    637625        case PGPPublicKey.DSA:
    638626            algorithm = "Digital Signature Algorithm (DSA)"; break;
    639         case PGPPublicKey.EC:
     627        case PGPPublicKey.ECDH:
    640628            algorithm = "Elliptic Curve (EC)"; break;
    641629        case PGPPublicKey.ECDSA:
     
    703691
    704692    public PGPSecretKey generateKey()
    705             throws NoSuchAlgorithmException, NoSuchProviderException, PGPException, FileNotFoundException, IOException {
     693            throws NoSuchAlgorithmException, NoSuchProviderException, PGPException, IOException {
    706694
    707695        JTextField userId = new JTextField();
     
    738726        final String[] algos = {"DSA", "RSA"};
    739727        final JComboBox<?> algoBox = new JComboBox<Object>(algos);
    740         algoBox.addActionListener(new ActionListener() {
    741 
    742             @Override
    743             public void actionPerformed(ActionEvent e) {
    744                 JComboBox<?> cb = (JComboBox<?>) e.getSource();
    745                 String alg = (String) cb.getSelectedItem();
    746                 if (alg.equals("DSA")) {
    747                     strengthBox.setSelectedItem("1024");
    748                     strengthBox.setEnabled(false);
    749                 } else
    750                     strengthBox.setEnabled(true);
    751                 /*if (alg.equals("ECDSA")) {
    752                     curveBox.setEnabled(true);
    753                     strengthBox.setModel(new DefaultComboBoxModel(curvesizes));
    754                     strengthBox.setSelectedItem(curvesizes[curveBox.getSelectedIndex()]);
    755                     strengthBox.setEnabled(false);
    756                 } else {
    757                     curveBox.setEnabled(false);
    758                     strengthBox.setModel(new DefaultComboBoxModel(sizes));
    759                     strengthBox.setEnabled(true);
    760                 }*/
    761             }
     728        algoBox.addActionListener(e -> {
     729            JComboBox<?> cb = (JComboBox<?>) e.getSource();
     730            String alg = (String) cb.getSelectedItem();
     731            if ("DSA".equals(alg)) {
     732                strengthBox.setSelectedItem("1024");
     733                strengthBox.setEnabled(false);
     734            } else
     735                strengthBox.setEnabled(true);
     736            /*if (alg.equals("ECDSA")) {
     737                curveBox.setEnabled(true);
     738                strengthBox.setModel(new DefaultComboBoxModel(curvesizes));
     739                strengthBox.setSelectedItem(curvesizes[curveBox.getSelectedIndex()]);
     740                strengthBox.setEnabled(false);
     741            } else {
     742                curveBox.setEnabled(false);
     743                strengthBox.setModel(new DefaultComboBoxModel(sizes));
     744                strengthBox.setEnabled(true);
     745            }*/
    762746        });
    763747
     
    836820
    837821        PGPSignatureSubpacketVector subPck = null;
    838         PGPSignatureSubpacketGenerator spGen = null;
    839822        Date expire = cal.getDate();
    840823        if (expire != null && expire.after(now)) {
    841             spGen = new PGPSignatureSubpacketGenerator();
     824            final PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
    842825            spGen.setKeyExpirationTime(true, (expire.getTime()-now.getTime())/1000);
    843826            subPck = spGen.generate();
Note: See TracChangeset for help on using the changeset viewer.