It concerns programmatically extracting a private key from a keystore as well as the matching certificate on the sender side, then generating a signature with the private key and finally saving both cerificate and signature in a file each.
On the receiver's side the cerificate file is read in programmatically as well as the signature file, the public key is extracted from the certificate and finally used to programmatically verify the signature.
The tutorial doesn't print the full code for this. Instead, it merely prints some (plausible looking) snippets that the reader is supposed to use to modify the classes GenSig.java and VerSig.java that were provided in the preceding chapters of this lesson.
In short, I completely stayed within java tutorial material.
Still, when running my new and enhanced class VerSigWithCertificate.java after running my new and enhanced class GenSigWithCertificate.java I get the above mentioned "java.security.SignatureException: invalid encoding for signature" .
What am I missing?
Can anyone provide concrete code alterations to make it work?
As you can see, I hard coded some necessary infos into the code. Removing them will be my next step after the main problem is solved.
The code for both classes is as follows:
subject: "java.security.SignatureException: invalid encoding for signature" when following the Java Tutorial