java - Bouncy Castle : Detached Enveloped Signature Changes at Every Run -
i following post generating , verifying digital signature. signed data remains constant @ runs detached enveloped signature varies @ every run. how same text generates different detached enveloped signature?
to make comments answer...
there 2 major reasons why signatures of same data same private key may vary.
signature algorithm induced variations
certain signature algorithms, foremost dsa , ecdsa, explicitly base signature creation on randomly chosen value k. "randomness" required, the entropy, secrecy, , uniqueness of random signature value k is critical. critical violating 1 of 3 requirements can reveal entire private key attacker. using same value twice (even while keeping k secret), using predictable value, or leaking few bits of k in each of several signatures, enough break algorithm. requirement can fulfilled random k or k built in deterministic way guarantees entropy, secrecy, , uniqueness, cf. rfc 6967.
the op, though, refers code uses rsa. algorithm not require such random parameter (even though padding schemes may include randomness).
signature attribute induced variations
another reason variations signed data include more document data.
when talking "signatures", people not merely mean signing process byte array output instead signature container according cms standard.
there may multiple individual signatures in such container, , each of them may have number of unsigned or signed attributes. name "signed attributes" implies, signature value calculation includes these attributes, too.
very these signed attributes include signing time. signing time varies in different signing runs, actual signature value varies, too.
the op uses cms signature containers. thus, cause why op's signatures vary.
Comments
Post a Comment