FIPS in 100 Examples error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FIPS in 100 Examples error

Scott Suler
Hi,

When I try to run the base\Aes.java class from the FIPS 100 Examples source download, I get the following exception:

Exception in thread "main" java.lang.NullPointerException
at org.bouncycastle.jcajce.provider.BaseCipher.engineGetParameters(Unknown Source)
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1020)
at javax.crypto.Cipher.init(Cipher.java:1245)
at javax.crypto.Cipher.init(Cipher.java:1186)
at bcfipsin100.base.ecbEncrypt(Aes.java: 46)

cipher.init(Cipher.ENCRYPT_MODE, key) is being called n the ecbEncrypt

Any theories what I may be doing wrong?  I am running on Windows 7 / Java 8

Thanks for any help
Scott
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FIPS in 100 Examples error

Scott Suler
Sorry I see the answer in the known issues.

Sent from my iPad

> On Dec 23, 2016, at 2:22 PM, Scott Suler <[hidden email]> wrote:
>
> Hi,
>
> When I try to run the base\Aes.java class from the FIPS 100 Examples source download, I get the following exception:
>
> Exception in thread "main" java.lang.NullPointerException
> at org.bouncycastle.jcajce.provider.BaseCipher.engineGetParameters(Unknown Source)
> at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1020)
> at javax.crypto.Cipher.init(Cipher.java:1245)
> at javax.crypto.Cipher.init(Cipher.java:1186)
> at bcfipsin100.base.ecbEncrypt(Aes.java: 46)
>
> cipher.init(Cipher.ENCRYPT_MODE, key) is being called n the ecbEncrypt
>
> Any theories what I may be doing wrong?  I am running on Windows 7 / Java 8
>
> Thanks for any help
> Scott

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FIPS in 100 Examples error

jkalina
This post has NOT been accepted by the mailing list yet.
For future generations: For mentioned exception there is simple workaround:

Instead of:
cipher.init(Cipher.ENCRYPT_MODE, key)
use:
cipher.init(Cipher.ENCRYPT_MODE, key, (AlgorithmParameterSpec) null)

This will ensure algorithm params will not be used to check permissions, whose obtaining before Crypto SPI init was causing the fail.

Scott Suler wrote
> When I try to run the base\Aes.java class from the FIPS 100 Examples source download, I get the following exception:
>
> Exception in thread "main" java.lang.NullPointerException
> at org.bouncycastle.jcajce.provider.BaseCipher.engineGetParameters(Unknown Source)
> at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1020)
> at javax.crypto.Cipher.init(Cipher.java:1245)
> at javax.crypto.Cipher.init(Cipher.java:1186)
> at bcfipsin100.base.ecbEncrypt(Aes.java: 46)
>
> cipher.init(Cipher.ENCRYPT_MODE, key) is being called n the ecbEncrypt
>
> Any theories what I may be doing wrong?  I am running on Windows 7 / Java 8
Loading...