# Digital Signature Algorithm signature creation

I was studying DSS from "Cryptography and Network Security" by William Stallings. What puzzled me was the DSS approach figure described in the text. It says it uses Public and Private Keys for creating signature.

But the algorithm for creating signature in DSA doesn't use it.

$$r = (g^{k}\mod p)\mod q$$ $$s = (k^{-1}(H(M)+ x\cdot r)) \mod q$$

Someone please tell me the importance of public key here. Is it needed in verification only?

-

## migrated from stackoverflow.comSep 7 '11 at 17:15

This question came from our site for professional and enthusiast programmers.

Typically it is the value of the key itself ($y$), plus information about the group (safe prime $p$, subgroup size $q$, generator of subgroup $g$). For signing a message, you do not need the value of the public key itself. So if you are strict in defining a "public key" to only be $y$, it is not needed to sign (only to verify).
On the other hand, you do need the group description ($p,q,g$) to sign a message, as well as the secret key ($x$). If you are liberal and define "public key" to include the group description, then the public key (or parts of it) is needed to sign.
I am not sure what is meant by PU$_\mathrm{G}$ in the diagram, but I suspect it is the group description? In that case, Stallings is being liberal in his definition of a public key in that it includes the group information ($p,q,g$).
As an aside, even though you do not need the public key, you do need $g$ and $x$ and since $y=g^x$, you do "know" the public key at signing time even if you do not use the value $y$ explicitly.