Using SHA1 and RSA with java.security.Signature vs. MessageDigest and Cipher

OK, I’ve worked out what’s going on. Leonidas is right, it’s not just the hash that gets encrypted (in the case of the Cipher class method), it’s the ID of the hash algorithm concatenated with the digest: DigestInfo ::= SEQUENCE { digestAlgorithm AlgorithmIdentifier, digest OCTET STRING } Which is why the encryption by the Cipher … Read more

Digitally sign PDF files [closed]

The open source iTextSharp library will allow you to do this. Here’s a post explaining how to digitally sign a pdf file. If you don’t want to use a third party library then you can implement it yourself but it could be a tough task -> you can start by reading the pdf specification (8.6MB)

How do I find out which keystore was used to sign an app?

First, unzip the APK and extract the file /META-INF/ANDROID_.RSA (this file may also be CERT.RSA, but there should only be one .RSA file). Then issue this command: keytool -printcert -file ANDROID_.RSA You will get certificate fingerprints like this: MD5: B3:4F:BE:07:AA:78:24:DC:CA:92:36:FF:AE:8C:17:DB SHA1: 16:59:E7:E3:0C:AA:7A:0D:F2:0D:05:20:12:A8:85:0B:32:C5:4F:68 Signature algorithm name: SHA1withRSA Then use the keytool again to print out all … Read more