0

I have simple method getSigner which return new Signer (XadesSigner object). The same method works on simple console java application but in Android throws XadesProfileResolutiionException. Anyone help me?

private XadesSigner getSigner(String pfxPath, String password) throws SigningKeyException {

    try {
        KeyingDataProvider keyingProvider = getKeyingDataProvider(pfxPath, password);
        XadesSigningProfile p = new XadesBesSigningProfile(keyingProvider);
        return p.newSigner();

    } catch (KeyStoreException ex) {
        throw new SigningKeyException("Keystore Problem", ex);
    } catch (SigningCertChainException ex) {
        throw new SigningKeyException("Signer Cert Chain Problem", ex);
    } catch (UnexpectedJCAException ex) {
        throw new SigningKeyException("JCA Problem", ex);
    } catch (XadesProfileResolutionException ex) {
        throw new SigningKeyException("XadesProfileResolutionException Problem", ex);
    }
}
treekt
  • 147
  • 1
  • 12
  • Can you add the details of the (inner) exception? – lgoncalves May 18 '18 at 10:00
  • @Igoncalves I took cause of exception and i got "xades4j.utils.XadesProfileResolutionException: java.lang.ExceptionInInitializerError" – treekt May 21 '18 at 10:46
  • @Igoncalves Caused by: xades4j.utils.XadesProfileResolutionException: java.lang.ExceptionInInitializerError at xades4j.utils.XadesProfileCore.getInstance(XadesProfileCore.java:223 at xades4j.production.XadesSigningProfile.newSigner(XadesSigningProfile.java:112) at pl.ezla.mobile.business.podpis.EPodpisOswiadczenieBusiness.getSigner – treekt May 21 '18 at 11:04
  • There's no message in any of those? It could be something with Guice usage. The library was never really tested in Android.. – lgoncalves May 22 '18 at 12:52
  • @Igoncalves here is whole error -> https://pastebin.com/DXPG91DV – treekt May 22 '18 at 12:57
  • I have no clue what it is. The root cause seems to be "java.lang.UnsupportedOperationException: can't load this type of class file at java.lang.ClassLoader.defineClass(ClassLoader.java:594)" I don't know enough of Java or Android to be able to tell what the problem may be. Can try to dig a bit more though.. – lgoncalves May 22 '18 at 14:30
  • @treekt can you provide a sample Android project replicating this issue? – jzeferino May 22 '18 at 14:37
  • That would be good. We can create an issue in GH to try to troubleshoot this further and discuss any outcome. (Thanks @jzeferino) – lgoncalves May 22 '18 at 15:15
  • Ok guys I have created simple android project. First choose document xml, next choose certificate and type password. And last step - click sign button... If password is okey and you selected every files then app throw away the XadesProfileResolutionException. And remember about permissions in Android Settings App because in another case app throw UnexpectedJCAException. Link: https://github.com/treekt/xadesSigning – treekt May 23 '18 at 11:25
  • https://github.com/luisgoncalves/xades4j/issues/154 – lgoncalves May 23 '18 at 12:43
  • Did you resolve that issue guys ? – KarolR Apr 05 '19 at 14:46

0 Answers0