I have a PKCS#1 RSA Key.
Using Java I generated a digital signature for a text file with the word, "hello". Reference for Java implementation I used: https://docs.oracle.com/javase/tutorial/security/apisign/step3.html
Signature mysig = Signature.getInstance("SHA256withRSA","SUN");
mysig.initSign(mykey); //mykey is the PKCS#1 RSA key
mysig.update(data.getBytes()); //data is the text file with the word hello
byte[] signdata = mysig.sign();
Using the SAME PKCS#1 RSA Key, I generated digital signature for the SAME file, using OpenSSL
openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
Turns out that the digital signature generated by Java and OpenSSL does not match. Wondering why is that?