jce

Creating a provider. I receive this exception java.lang.SecurityException

Hello, I'm trying to create a provider. when I run the code i receive this exception Exception in thread "main" java.lang.SecurityException: JCE cannot authenticate the provider MyProvider at javax.crypto.Cipher.getInstance(DashoA13*..) at javax.crypto.Cipher.getInstance(DashoA13*..) at hellman.Main.main(Main.java:68) Cause...

How to authenticate my own provider( only for testing purposes)

Dear all Now, I wrote a new provider (ESMJCE provider), and I also write a simple application to test it, but I have some exceptions like that java.lang.SecurityException: JCE cannot authenticate the provider ESMJCE at javax.crypto.Cipher.getInstance(DashoA13*..) at javax.crypto.Cipher.getInstance(DashoA13*..) at testprovider.main(test...

JCE provider implementation.

Hello, I need to write a java JCE provider. I have been looking in the net for several days and I could not find solution. Could you please give me some useful informaion. Regards, ...

Decrypting “long” message encrypted with RSA java

Hi this is the same question, that was asked two years ago: Java/JCE: Decrypting “long” message encrypted with RSA I had a large byte array and rsa keypair, initiated by value 1024. Using rsa encryption and the specified size of the key is strong requirement, I can't change it. So I can't use symmetric encryption with asymetric encrypti...

How to read a password encrypted key with java?

Hi, I have private key stored in file in PKCS8 DER format and protected by password. What is the easiest way to read it? Here is the code I use to load unencrypted one: InputStream in = new FileInputStream(privateKeyFilename); byte[] privateKeydata = new byte[in.available()]; in.read(privateKeydata); in.close(); KeyFactory privateKey...

RSA public key exportation

Dear all, Here is my code KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); KeyPair myPair = kpg.generateKeyPair(); PrivateKey k = myPair.getPrivate(); System.out.print(k.serialVersionUID); Cipher c = Cipher.getInstance("RSA"); c.init(Cipher.ENCRYPT_MODE, myPair.getPublic()); String myMessage...

What are the benefits of using fips for the JCE?

I used the FIPS provider in the JCE, but couldn't really see any difference - I specifically looked for the maximum key sizes but didn't find any difference there. What advantages does enabling FIPS actually provide? ...

NoSuchAlgorithmException: Algorithm HmacSHA1 not available

Look at the following line of java: Mac.getInstance("HmacSHA1"); If I put this in a simple test program, it runs without problems on my server. However, if I use this line in a container, I get java.security.NoSuchAlgorithmException: Algorithm HmacSHA1 not available at javax.crypto.Mac.getInstance(DashoA13*..) The same JDK instal...

Convert Public Key to something readable for sharing

How can I convert RSAPublicKey into something readable (public key sharing reasons) and then convert it back to RSAPublicKey? ...

Implementation of ECC in Java

While trying to encrypt a given input using Elliptic Curve Cryptography in Java I'm using the following algorithms for generating the cipher and the key: KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA"); Cipher cipher = Cipher.getInstance("ECIES"); Now as expected, the cipher isn't accepting the keys generated by th...

How to use Bouncy Castle lightweight API with AES and PBE

I have a block of ciphertext that was created using the JCE algorithim "PBEWithSHA256And256BitAES-CBC-BC". The provider is BouncyCastle. What I'd like to do it decrypt this ciphertext using the BouncyCastle lightweight API. I don't want to use JCE because that requires installing the Unlimited Strength Jurisdiction Policy Files. Documen...

Generate one-time key with AES in Counter mode

How to generate one-time key in AES counter mode using java cryptography? I want to use that one-time key as session key in my PGP implementation? ...

StackOverFlowError while creating Mac object on AS400/Java

Hello all, I am a newbie to AS400-Java programming. I am trying to create my first program to test the implementation of Message Authentication Code (MAC). I am trying to use the HMACSHA1 hash function. My (Java 1.4) program runs fine on a dev box (V5R4).But fails terribly on the QA box (V5R3). My program is as below: =================...

Location of policy file on Debian

I'm working on an application/library, under DebianOS, that requires the presence of certain standard policy files (related to unlimited strength ciphers, 192, 256 bit AES keys). However, there seems to a problem which I think is related to the application not being able to find these policy files (.jar files). Sun recommends these fi...

DoD PKI CAC authentication in Tomcat (embedded in JBoss)

I need to support DoD issued CAC-based authentication in my web application deployed in JBoss. Could someone give me pointers on where to start, the steps involved, etc? Also, which JCE provider should I go with (OpenSSO, BountyCastle, etc)? I tried to google for a list of (active/current) providers but couldn't really find it. Is there...

Jce editor groups- problems with multi permission

I have Joomla site with JCE editor. I use the JCE groups to create permissions for different users. I have created few groups and every group is permitted to control one media directory. I have combined a specific user to two different groups assuming that this user will have the ability to access two different media directories. But ...

How would I use Maven to install the JCE Unlimited Strength Policy files?

Some code I have requires the JCE unlimited Strength Policy Files. I'd like to add this dependency into the Maven Pom file so the other developers on my team don't have to individually each apply this to their systems. I realize that the systems this is eventually deployed to will need to have the JCE files manually installed. This is ...

Password based encryption using AES in java 5 (JCE only)

I would like to use AES (192 or 256 bits), but am stuck on how to generate a key from a user supplied password. I have gone through this thread, and am able to run the program in Java 6. However, I need to run the same program in Java 5, and SecretKeyFactory for PBKDF2WithHmacSHA1 is not available in JDK 5. So, essentially, I need to g...

Why java.security.NoSuchProviderException No such provider: BC?

The jar (bcprov-jdk16-145.jar) has been added to the project, Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()) has been added to the class, and BouncyCastleProvider.PROVIDER_NAME does return "BC" but AesFileIo.writeFile() still throws java.security.NoSuchProviderException No such provider: BC. Any ideas? im...

InvalidKeyException Illegal key size

I have a test which runs great on my development MacBook Pro, but fails to run in continuous integration TeamCity server. The error is following: java.security.InvalidKeyException: Illegal key size at javax.crypto.Cipher.a(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) Both ...