How to convert to PHP code.

Well, this is actually a german forum. I am gonna make an exception here and answer this in english.

Maybe a possible solution would be to convert the Java code into a program that is runnable via command line. Then you could just call it from PHP?

Otherwise you would actually need to translate the code into PHP-conform routines, which might be hard since you are using built-in modules of Java here. (I don't know what exactly the crypto module can and cannot do)

We are here to help you with your problems and support you wherever we can. However, we will not do the work for you. Since you said you are very unexperienced in Java, you might be better off to hand this in as a (paid) job request - especially if you are in a hurry.

Best regards