1

I'm unable to start the jar if I create it via maven, debugging works just fine. I have done the decryption: RSA/NONE/OAEPPadding (I am using bouncycastle) and although I register bouncy caste, java doesn't notice it.This doesn't happen if I debug it in intellij. The console output is the following:

adding BouncyCastleProvider2
java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/NONE/OAEPPadding
    at javax.crypto.Cipher.getInstance(Cipher.java:535)
    at leanderk.rplay.library.RTSPResponder.decryptRSA(RTSPResponder.java:338)
    at leanderk.rplay.library.RTSPResponder.handlePacket(RTSPResponder.java:200)
    at leanderk.rplay.library.RTSPResponder.listenAndProcessPackets(RTSPResponder.java:431)
    at leanderk.rplay.library.RTSPResponder.run(RTSPResponder.java:377)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

and the Java code:

System.out.println("adding BouncyCastleProvider2");
        try {
            Security.addProvider(new BouncyCastleProvider());
        } catch (Error e) {
            e.printStackTrace();
        }
        try{
            // La clef RSA
            PEMReader pemReader = new PEMReader(new StringReader(key));
            KeyPair pObj = (KeyPair) pemReader.readObject(); 

            // Encrypt
            Cipher cipher = Cipher.getInstance("RSA/NONE/OAEPPadding"); 
            cipher.init(Cipher.DECRYPT_MODE, pObj.getPrivate());
            return cipher.doFinal(array);

        }catch(Exception e){
            e.printStackTrace();
        }

(I am catching the error out of desperation, was hoping for a noclassdef)

here is my maven-assembly-plug-in (the only other plug-in is the compiler plugin):

             <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>leanderk.rplay.library.Main</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
EugenSunic
  • 13,162
  • 13
  • 64
  • 86
Leander
  • 1,322
  • 4
  • 16
  • 31

0 Answers0