Closed DanskerDave closed 3 years ago
Yes, you'd expect this. See:
The time resolution used is 1 second. Note that is possible to hard code the creation time. If you do that you will see the same signature block being generated always.
If the question is concerning the actual cryptographic signature - RSA is a deterministic algorithm so the cryptographic signature being generated is always the same. If you want to see the difference with a non-deterministic one try DSA.
ok, thanks for the Info. I experimented a bit with spGen.addCustomSubpacket(new SignatureCreationTime(false, false, customBytes));
, adding Nanoseconds cast to int in the customBytes, which introduced a salt, thereby changing the signature. I also tried a Custom SignatureSubpacket
: I wanted to add a FileName Tag as mentioned in RFC 4880 §5.9 (Tag 11), but couldn't find the correct Tag-value for "File Name" so just used one of those earmarked for "Private use" (100)
5.9 is refering to literal data, which is a encapsulation packet for encrypted and signed data. It's used for creating binary data.
While testing generation of a PGPSignature in a loop, always using the same input, I noticed I was getting identical signatures within a short timeframe.
That did rather surprise me: I had been expecting the Signature not to be (trivially) reproducible.
Is this behaviour intended?
After roughly (exactly, I presume) 1 second a different Signature is returned.
Bouncy Castle Packages used: bcpg-jdk15on-168.jar bcprov-jdk15on-168.jar
Java Version: openJDK v14.0.2, x64
Here's a little self-contained example Proggy to highlight this: