1

How must i change the Standard Implemplementation of the Serpent Algorithm that i can use it with the javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream?

I must implement/extends the Cipher class and when i do it, what must i change?

The Original Implementation of the Serpent Algorithm is here http://www.cl.cam.ac.uk/~rja14/serpent.html

Exist a Implementation of the Serpent Algorithm that's implement Cipher? I found the Java implementation of the Algorithm on the Page of its Creator. The Problem in this is: i can't use it with javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream.

I try to use the ObjectOutputStream to write a Configuration File, but i would like to encrypt it with the Serpent Algorithm. The same is with the reading of this Configuration file.

I don't want to use API's like the BouncyCastle and flexiprovider because they create a to heavy boilerplate which i don't need.

What is the best practice to use a finished (final and tested) Algorithm that dont extends/implements Cipher and it should be used in javax.crypto.CipherXxxStream?

  • This is a very broad question. Probably too broad to be answerable here. – Adam Zuckerman May 7 '14 at 20:59
  • The main Problem i have is: what must i do/change when i extend from the Cipher Class to make use of the Serpent Algorithm found on the Website. I can't figure out what i must do to make this Algorithm really usable in Java (yes i can use it the normal way, but the transparent way with stream is much more elegant). The main problem by BouncyCastle etc is that i must delivery the librarys and the SecurityProvider make all kinds of Algorithm available that i dont need. – Serverfrog May 7 '14 at 21:02
1

Here is a walkthrough of how to implement a cipher for Java: Writing your own JCA extensions - a full cipher

The key points from the article are:

Create key classes

We will create a Caesar cipher implementation. You could also do ROT13 with it. As ciphers are about encryption/decryption we need some keys. Our key class will be very simple as we just need to store an offset for shifting our letters later on.

Start by creating a new Java Project named com.example.jce.cipher.

Implement the cipher

Ciphers are implemented extending CipherSpi (as all JCA extensions extend a WhateverSpi class).

Create a JCE provider

As for the digest, we need to usa a provider to register our digest in the JRE.

Using our provider

Create a new Java project com.example.jce.cipher.consumer. Create a subfolder libs and store your signed JAR file there. Then add this JAR to the Java Build Path.

Now everything is in place to use our cipher.

The article also mentions that you must have a certificate from Oracle to sign your cipher or the process cannot be completed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.