# Cipher.getInstance() doesn't find my cipher class, what's wrong?

Cyrill Osterwalder (costerwa@iiic.ethz.ch)
Tue, 08 Dec 1998 13:51:39 +0100

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Srivatsan Kannan: "HTTPS and URL"
- Previous message: 5411@java.sun.com: "Great Gift Idea"
- Next in thread: Jan Luehe: "Re: Cipher.getInstance() doesn't find my cipher class, what's wrong?"

Hi Java Security Team,

I implemented my own security provider (mypackage.crypto.MyProvider)
with a signature and a cipher algorithm. My provider is registered in
the 'java.security' configuration
file and contains the mapping entries for the specified classes
(mypackage.crypto.ElGamalCipher and mypackage.crypto.ElGamalSignature).

When calling the Signature.getInstance("ElGamalSignature") method,
everything's ok, so I guess the provider is installed correctly, but
when I want to get an instance of my cipher, the
Cipher.getInstance("ElGamalCipher") method throws an exception because
it
doesn't find the appropriate class file though IT REALLY IS in the
specified place (mypackage.crypto.ElGamalCipher). I checked file naming
and
so on a hundred times.

Here ist the output:
-----
TestElGamal: exception caught:
class configured for Cipher (provider: MyProvider) cannot be found.
mypackage.crypto.ElGamalCipher
java.security.NoSuchAlgorithmException: class configured for Cipher
(provider: MyProvider) cannot be found.
mypackage.crypto.ElGamalCipher
at java.lang.Throwable.<init>(Compiled Code @ 0xb143c)
at java.lang.Exception.<init>(Exception.java:42)
at
java.security.GeneralSecurityException.<init>(GeneralSecurityException.java:48)
at
java.security.NoSuchAlgorithmException.<init>(NoSuchAlgorithmException.java:45)
at javax.crypto.JceSecurity.getImpl(JceSecurity.java:205)
at javax.crypto.Cipher.getInstance(Compiled Code @ 0x1e0618)
at TestElGamal.main(TestElGamal.java:27)
-----

I tried this with both the SunJCE1.2ea2 and the IAIK crypto extensions
and the error was the same. Am I missing anything here? Is there a
difference between Signature.getInstance() (java.security) and
Cipher.getInstance() (javax.crypto) concerning class loading? The class
file ElGamalCipher.class is in the package 'mypackage.crypto'.

Any help would be greatly appreciated!

regards,

    --
    Cyrill Osterwalder
    Email: costerwa@iiic.ethz.ch

- Next message: Srivatsan Kannan: "HTTPS and URL"
- Previous message: 5411@java.sun.com: "Great Gift Idea"
- Next in thread: Jan Luehe: "Re: Cipher.getInstance() doesn't find my cipher class, what's wrong?"