Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unsigned jar runs, signed doesn't!

0 views
Skip to first unread message

Diego Pietralunga

unread,
Mar 27, 2002, 5:57:05 AM3/27/02
to
I have a problem running an application from within a SIGNED jar file
(actually 3).
I i run the application from an UNSIGNED jar file, it works, but if I
sign the jars and run it I get strange errors (about security I guess).
The app uses BackgroundJPanel class (follows) that dispalys an image in
a JFrame (from Swing forum)
The jars used a self-signed certificate from keytool and jarsigner
verifies them.
The problem is the JPEG image stored in the jar (I think) I also tried
"getResource(URL)" but gives a similar error stopping at
"getImageIcon()"

Using "java -cp jar1.jar;jar2.jar:jar3.jar" the app begin starting then
I get this:
"
Exception in thread "main" java.lang.ClassCastException:
iaik.asn1.structures.Name
at sun.security.pkcs.PKCS7.getCertificate(PKCS7.java:574)
at sun.security.pkcs.SignerInfo.getCertificate(SignerInfo.java:203)
at sun.security.pkcs.SignerInfo.verify(SignerInfo.java:329)
at sun.security.pkcs.PKCS7.verify(PKCS7.java:468)
at sun.security.pkcs.PKCS7.verify(PKCS7.java:485)
at

sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:148)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:284)
at java.util.jar.JarVerifier.update(JarVerifier.java:197)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:248)
at java.util.jar.JarFile.getInputStream(JarFile.java:310)
at

sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:120)
at java.net.URL.openStream(URL.java:798)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:897)
at it.ltt.signwiz.gui.BackgroundJPanel.<init>(BackgroundJPanel.java:40)
at

it.ltt.signwiz.gui.wizardframework.WizardFrame.<init>(WizardFrame.java:69)
at

it.ltt.signwiz.gui.wizardframework.WizardFrame.<init>(WizardFrame.java:146)
at it.ltt.signwiz.gui.GMain.<init>(GMain.java:296)
at it.ltt.signwiz.start.GUI._$874(GUI.java:61)
at it.ltt.signwiz.start.GUI.main(GUI.java:81)

"
Can you help?
Info: JDK 1.3.1 - build 1.3.1-b24, W2K SP2

P.S.JDK 1.4 gives me a different error (about security too)


/*********************************************************/
public class BackgroundJPanel extends JPanel {

Image image=null;
int ww, hh = 0;
ImageIcon theImageIcon= null;
URL theImgURL = null;


public BackgroundJPanel()
{
super();
//ImgResourceAnchor is in the same dir as the JPEG image
ClassLoader cl = ImgResourceAnchor.class.getClassLoader();
InputStream is =

cl.getResourceAsStream("com/mycompany/myApp/res/img/main_background_2-460-300.jpg");
java.io.ByteArrayOutputStream baos = null;
baos = new ByteArrayOutputStream();

if (is == null)
{
Message.debugMsg("Image Not found");
System.out.println("Image Not found");
}
try{
int c;
while ( (c = is.read()) >= 0 )
{
baos.write(c);
}
}catch(IOException ioex)
{
ioex.printStackTrace();
}

try{
this.theImageIcon =
new ImageIcon(baos.toByteArray());

Message.debugMsg("BackgroundJPanel: init(): getting image");
image = this.theImageIcon.getImage();
Message.debugMsg("BackgroundJPanel: init(): got image");

ww = image.getWidth(this);
hh = image.getHeight(this);

}
catch(Exception ex)
{
Message.debugMsg( ex.getMessage());
}
//image = getToolkit().createImage(baos.toByteArray());
// ww = image.getWidth(this);
//hh = image.getHeight(this);

}

public void paintComponent(Graphics g)
{

if ( (image!=null) && (ww>0) && (hh>0) )
{
for (int y = 0; y < this.getHeight() - 1; y += hh)
for (int x = 0; x < this.getWidth() - 1; x += ww)
g.drawImage(image, x, y, this);
}
else
super.paint(g);
}


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

0 new messages