osgi security with signed war file -
can me?
i use osgi security in application. therefore wrote security bundle, grant bundles signed keystore. 1 of bundles war file (bundle10). if start server (glassfish felix) on deployed war bundle, java.lang.securityexception:
exception while processing web-inf/classes/com/xy/someclass.class inside file:/tmp/osgiapp430591893594363740/web-inf/lib/bundle10.jar of size 2.111 java.lang.securityexception: invalid signature file digest manifest main attributes @ sun.security.util.signaturefileverifier.processimpl(signaturefileverifier.java:221) @ sun.security.util.signaturefileverifier.process(signaturefileverifier.java:176) @ java.util.jar.jarverifier.processentry(jarverifier.java:288) @ java.util.jar.jarverifier.update(jarverifier.java:199) @ java.util.jar.jarfile.initializeverifier(jarfile.java:327) @ java.util.jar.jarfile.getinputstream(jarfile.java:395) @ com.sun.enterprise.deployment.deploy.shared.inputjararchive.getentry(inputjararchive.java:244) @ com.sun.enterprise.v3.server.readablearchivescanneradapter.handleentry(readablearchivescanneradapter.java:166) @ com.sun.enterprise.v3.server.readablearchivescanneradapter.onselectedentries(readablearchivescanneradapter.java:133) @ org.glassfish.hk2.classmodel.reflect.parser.dojob(parser.java:348) @ org.glassfish.hk2.classmodel.reflect.parser.access$300(parser.java:70) @ org.glassfish.hk2.classmodel.reflect.parser$3.call(parser.java:307) @ org.glassfish.hk2.classmodel.reflect.parser$3.call(parser.java:296) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303) @ java.util.concurrent.futuretask.run(futuretask.java:138) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:895) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:918) @ java.lang.thread.run(thread.java:662)
i signed bundle maven jasigner plugin.
the exception tells digest in signers.sf manifest main section incorrect. section contains osgi metadata. looks war turned bundle after signed?
signing quite complicated. manifest contains 2 sections, main section , section per resource in jar. each of these resource sections start name: attribute identifying path resource. when want sign jar first create manifest , resource section each attribute, resource section contains 1 or more digests (sha, md5, etc) of resource.
you can have multiple signers have pick name each signature file. in signature file again have main section , number of resource sections. in main section must have 1 or more of the
x-digest-manifest-attributes: <x digest of manifest main section>
the x can again 1 of digest algorithms used. resource sections in manifest must contain digest of corresponding resource section in manifest (not resource!).
manifest.mf <>.sf +--------------+ main |bundle-sym .. | <--- x-digest-manifest-main-attributes: 345678... |bundle-vers.. | +--------------+ name |name: a.class | <--- name: a.class |x-digest: 56a5| x-digest: 4789... +--------------+ |name: b.class | <--- name: b.class |x-digest: ace | x-digest: 65123... +--------------+
in short, main manifest section not signed. either missing -digest-manifest-main-attributes in <>.sf file or (likely) calculated before calculated osgi headers.
if you're using bnd, can sign bundle directly bnd.
Comments
Post a Comment