【问题标题】:*.rsa and *.sf manifest.mf calling from java class*.rsa 和 *.sf manifest.mf 从 java 类调用
【发布时间】:2015-03-06 21:24:37
【问题描述】:

我已经放弃了一个 jar 文件并运行了它。但是,它在打开后立即关闭。是否可以从 java 代码中调用 *.rsa 或 *.sf 或 manifest.mf 的信息来检查是否更改,谢谢。

【问题讨论】:

  • 当我将原始 *.rsa、*.sf 和 manifest.mf 放入时,它的工作正常......
  • 打开一个 DOS 框并运行它,以便您阅读错误消息。
  • 离职前有哪些变化?
  • 其实我改变了一些东西,但是没有用。然后我认为辞职可能有问题,我刚刚导出为 zip 原始文件并删除了 META-INF/ (.rsa, *.sf) 文件并再次辞职。但它引起了我的注意,现在辞职的 jar 文件有 META-INF/ (.dsa, *.sf) 文件。 dsa而不是rsa有很大区别吗,如果是如何在ubuntu os中像原来一样签名,谢谢。
  • 我已经用 rsa 签名了 jar 文件,给出了警告:警告:“签名者证书尚未生效。没有提供 -tsa 或 -tsacert 并且这个 jar 没有时间戳。没有时间戳,在签名者证书的到期日期 (2015-06-04) 或任何未来的撤销日期之后,用户可能无法验证此 jar。”但是,它不再起作用了..

标签: java security rsa


【解决方案1】:

其实我在jar文件及其返回证书的类中找到了一个方法,也就是说jar文件中有一个证书控制桥,代码是:

    private Certificate[] XQ(et etProp) throws Exception{
        System.out.println("Rg test 78");
    String value = null;
    Iterator iterator = etProp.af().iterator();

    while (iterator.hasNext()) {

        un.JI innerUn = (un.JI) iterator.next();
        String certificateToUpperCase = innerUn.XQ().toUpperCase();


        if (certificateToUpperCase != null && certificateToUpperCase.startsWith("META-INF/")
                && (certificateToUpperCase.endsWith(".RSA") || certificateToUpperCase.endsWith(".DSA"))) {

            value = innerUn.XQ();
            break;
        }

    }

    if (value == null) {
                System.out.println("Rg test 81");
        qm.XQ((String) "Could not find certificates file");
        return null;
    } else {
                System.out.println("Rg test 82");
        byte[] arrayAf = etProp.af(value);
        if (arrayAf == null) {
                        System.out.println("Rg test 83");
            Object[] objectsArray = new Object[] { value };
            return null;
        } else {
                        System.out.println("Rg test 84");
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(arrayAf);

            Collection collection;
            try {
                                System.out.println("Rg test 85");
                CertificateFactory certificateFactory = CertificateFactory
                        .getInstance("X.509");
                collection = certificateFactory.generateCertificates(byteArrayInputStream);
            } catch (CertificateException ex) {
                qm.XQ((String) String.format(
                        "Could not parse certificate data: %s",
                        new Object[] { ex.toString() }));
                return null;
            }

            Certificate[] certificates = new Certificate[collection.size()];
            int i = 0;

            Certificate certificate;
            for (Iterator iterator1 = collection.iterator(); iterator1.hasNext(); certificates[i++] = certificate) {
                                System.out.println("Rg test 87");
                certificate = (Certificate) iterator1.next();
            }

            return certificates;
        }
    }
}

保护jar文件不被破解是一个很好的举措。

【讨论】:

    猜你喜欢
    • 2017-03-24
    • 2013-08-02
    • 2010-09-24
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 2012-09-27
    • 2011-04-16
    • 2011-03-07
    相关资源
    最近更新 更多