Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 54025 invoked from network); 23 Dec 2004 09:35:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 23 Dec 2004 09:35:08 -0000 Received: (qmail 48670 invoked by uid 500); 23 Dec 2004 09:34:09 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 48595 invoked by uid 500); 23 Dec 2004 09:34:09 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 48496 invoked by uid 99); 23 Dec 2004 09:34:07 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=FROM_ENDS_IN_NUMS,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of antonypaul24@gmail.com designates 64.233.184.193 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.193) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 23 Dec 2004 01:34:04 -0800 Received: by wproxy.gmail.com with SMTP id 50so69557wri for ; Thu, 23 Dec 2004 01:34:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=D3fAV7vcBx0PVwHdIPBWAHCJQHxd4J60VfsQxwSYe1PKLodD0JxVNixIW/DwdzpiZIgh7SBYDvy1syvt38NiB5c/jDiEVhDUuIDbPkdo81U00rUX1sPBjIx9/IGtbTje46DpEoooNNho5Rg86Cnx13Ve7hY+wUJKl6MjTOkIWv0= Received: by 10.54.13.65 with SMTP id 65mr83009wrm; Thu, 23 Dec 2004 01:34:01 -0800 (PST) Received: by 10.54.31.50 with HTTP; Thu, 23 Dec 2004 01:34:01 -0800 (PST) Message-ID: <2989532e04122301342bc52310@mail.gmail.com> Date: Thu, 23 Dec 2004 15:04:01 +0530 From: Antony Paul Reply-To: Antony Paul To: Tomcat Users List Subject: Re: Gurus! JCE and classloader question In-Reply-To: <2989532e04122301313f2392cd@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41C2DFC7.8030201@omnikles.com> <41C87440.7060807@omnikles.com> <2989532e04122301313f2392cd@mail.gmail.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Where you put the provider jar file ?. WEB-INF/lib ?. Try putting it in shared/lib or common/lib if the same jar file is used by multiple applications. rgds Antony Paul On Thu, 23 Dec 2004 15:01:04 +0530, Antony Paul wrote: > Which JCE provider you are using ? > > rgds > Antony Paul > > > On Tue, 21 Dec 2004 20:06:40 +0100, Lionel Pasquier > wrote: > > Hello again! > > > > Any guru around to solve my problem please? :-) > > > > Lionel Pasquier wrote: > > > > > Hello, > > > > > > I have a trouble with using a JCE and multiple contexts. From what I > > > could have read around here this is probably linked to a classloader > > > problem. Could you guys help? > > > > > > Basicaly, I generate a RSA Keypair, then create a certificate and want > > > to self sign it. Finally i need to store the private key to create a > > > p12. Here is the code: I am using the IAIK JCE. > > > > > > > > > KeyPair keyPair; > > > IAIK IAIKprovider = new IAIK(); > > > Security.insertProviderAt(IAIKprovider, 2); > > > KeyPairGenerator keyPairGenerator = > > > KeyPairGenerator.getInstance("RSA", IAIKprovider.getName()); > > > keyPairGenerator.initialize(keySize); > > > keyPair = keyPairGenerator.generateKeyPair(); > > > X509Certificate cert; > > > [...] > > > cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(), > > > IAIKprovider.getName()); > > > if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){ > > > > > > error("Generated RSA private key is not of type RSA!"); > > > } > > > KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(), > > > certLabel, certLabel.getBytes()); > > > > > > > > > The problem is that if I have more than one tomcat context using the > > > same pice of code, the 2nd context to use it triggers the "if" (that > > > is, without it I get a ClassCastException). Meaning that the generated > > > private key is not compatible with RSAPrivateKey, while I asked for a > > > "RSA" key. > > > > > > I also have the same problem with the other way around: > > > CertificateFactory certFactory = > > > CertificateFactory.getInstance("X.509", "IAIK"); > > > Collection certCollection = certFactory.generateCertificates(new > > > ByteArrayInputStream( certChainBlob.getDatabinary() )); > > > cert = (X509Certificate)certChain.get(0); //where X509Certificate > > > being iaik.x509.X509Certificate) > > > gets a ClassCastException if being the second context to call this code. > > > > > > > > > Oh, one more important thing: I add the security provider dynamicaly > > > with a: > > > Security.insertProviderAt(new IAIK(), 2); > > > > > > > > > Could someone help me on this? > > > > > > Thank you, > > > > > > Lionel > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org