**FIPS PUB 186-4 **

**FEDERAL INFORMATION PROCESSING STANDARDS ** **PUBLICATION **

**Digital Signature Standard (DSS) **

**C**

**ATEGORY:**

**C**

**OMPUTER**

**S**

**ECURITY**

**S**

**UBCATEGORY:**

**C**

**RYPTOGRAPHY**

### Information Technology Laboratory

### National Institute of Standards and Technology **Gaithersburg, MD 20899-8900 **

### Issued July 2013

**U.S. Department of Commerce **
*Cameron F. Kerry, Acting Secretary *

**National Institute of Standards and Technology **

### http://dx.doi.org/10.6028/NIST.FIPS.186-4

**FOREWORD **

### The Federal Information Processing Standards Publication Series of the National Institute of Standards and Technology (NIST) is the official series of publications relating to standards and guidelines adopted and promulgated under the provisions of the Federal Information Security Management Act (FISMA) of 2002.

### Comments concerning FIPS publications are welcomed and should be addressed to the Director, Information Technology Laboratory, National Institute of Standards and Technology, 100 Bureau Drive, Stop 8900, Gaithersburg, MD 20899-8900.

### Charles Romine, Director Information Technology Laboratory

**Abstract **

### This Standard specifies a suite of algorithms that can be used to generate a digital signature.

### Digital signatures are used to detect unauthorized modifications to data and to authenticate the identity of the signatory. In addition, the recipient of signed data can use a digital signature as evidence in demonstrating to a third party that the signature was, in fact, generated by the

### claimed signatory. This is known as non-repudiation, since the signatory cannot easily repudiate the signature at a later time.

*Key words: computer security, cryptography, digital signatures, Federal Information Processing *

### Standards, public key cryptography.

**Federal Information Processing Standards Publication 186-4 **

**July 2013 **

**Announcing the **

**DIGITAL SIGNATURE STANDARD (DSS) **

### Federal Information Processing Standards Publications (FIPS PUBS) are issued by the National Institute of Standards and Technology (NIST) after approval by the Secretary of Commerce pursuant to Section 5131 of the Information Technology Management Reform Act of 1996 (Public Law 104-106), and the Computer Security Act of 1987 (Public Law 100-235).

**1. Name of Standard: Digital Signature Standard (DSS) (FIPS 186-4). **

**2. Category of Standard: Computer Security. Subcategory. Cryptography. **

**3. Explanation: This Standard specifies algorithms for applications requiring a digital ** signature, rather than a written signature. A digital signature is represented in a computer as a string of bits. A digital signature is computed using a set of rules and a set of parameters that allow the identity of the signatory and the integrity of the data to be verified. Digital signatures may be generated on both stored and transmitted data.

### Signature generation uses a private key to generate a digital signature; signature verification uses a public key that corresponds to, but is not the same as, the private key. Each signatory

### possesses a private and public key pair. Public keys may be known by the public; private keys are kept secret. Anyone can verify the signature by employing the signatory’s public key. Only the user that possesses the private key can perform signature generation.

### A hash function is used in the signature generation process to obtain a condensed version of the data to be signed; the condensed version of the data is often called a message digest. The message digest is input to the digital signature algorithm to generate the digital signature. The hash functions to be used are specified in the Secure Hash Standard (SHS), FIPS 180. FIPS **approved digital signature algorithms shall be used with an appropriate hash function that is ** specified in the SHS.

### The digital signature is provided to the intended verifier along with the signed data. The

### verifying entity verifies the signature by using the claimed signatory’s public key and the same

### hash function that was used to generate the signature. Similar procedures may be used to

### generate and verify signatures for both stored and transmitted data.

**5. Maintenance Agency: Department of Commerce, National Institute of Standards and ** Technology, Information Technology Laboratory, Computer Security Division.

**6. Applicability: This Standard is applicable to all Federal departments and agencies for the ** protection of sensitive unclassified information that is not subject to section 2315 of Title 10, **United States Code, or section 3502 (2) of Title 44, United States Code. This Standard shall be ** used in designing and implementing public key-based signature systems that Federal

### departments and agencies operate or that are operated for them under contract. The adoption and use of this Standard is available to private and commercial organizations.

**7. Applications: A digital signature algorithm allows an entity to authenticate the integrity of ** signed data and the identity of the signatory. The recipient of a signed message can use a digital signature as evidence in demonstrating to a third party that the signature was, in fact, generated by the claimed signatory. This is known as non-repudiation, since the signatory cannot easily repudiate the signature at a later time. A digital signature algorithm is intended for use in

### electronic mail, electronic funds transfer, electronic data interchange, software distribution, data storage, and other applications that require data integrity assurance and data origin

### authentication.

**8. Implementations: A digital signature algorithm may be implemented in software, firmware, ** hardware or any combination thereof. NIST has developed a validation program to test

### implementations for conformance to the algorithms in this Standard. Information about the validation program is available at http://csrc.nist.gov/cryptval. Examples for each digital signature algorithm are available at http://csrc.nist.gov/groups/ST/toolkit/examples.html.

**Agencies are advised that digital signature key pairs shall not be used for other purposes. **

**9. Other Approved Security Functions: Digital signature implementations that comply with ** **this Standard shall employ cryptographic algorithms, cryptographic key generation algorithms, ** and key establishment techniques that have been approved for protecting Federal government sensitive information. Approved cryptographic algorithms and techniques include those that are either:

### a. specified in a Federal Information Processing Standard (FIPS), b. adopted in a FIPS or a NIST Recommendation, or

### c. specified in the list of approved security functions for FIPS 140.

**10. Export Control: Certain cryptographic devices and technical data regarding them are **

### subject to Federal export controls. Exports of cryptographic modules implementing this Standard and technical data regarding them must comply with these Federal regulations and be licensed by the Bureau of Industry and Security of the U.S. Department of Commerce. Information about export regulations is available at: http://www.bis.doc.gov.

**11. Patents: The algorithms in this Standard may be covered by U.S. or foreign patents. **

**12. Implementation Schedule: This Standard becomes effective immediately upon ** approval by the Secretary of Commerce. A transition strategy for validating algorithms and cryptographic modules will be posted on NIST’s Web page at

*http://csrc.nist.gov/groups/STM/cmvp/index.html under Notices. The transition plan * addresses the transition by Federal agencies from modules tested and validated for compliance to previous versions of this Standard to modules tested and validated for compliance to FIPS 186-4 under the Cryptographic Module Validation Program. The transition plan allows Federal agencies and vendors to make a smooth transition to FIPS 186-4.

**13. Specifications: Federal Information Processing Standard (FIPS) 186-4 Digital Signature ** Standard (affixed).

**14. Cross Index: The following documents are referenced in this Standard. Unless a specific ** version or date is indicated with the document number, the latest version of the given document is intended as the reference.

### a. FIPS PUB 140, Security Requirements for Cryptographic Modules.

### b. FIPS PUB 180 Secure Hash Standard.

### c. ANS X9.31-1998, Digital Signatures Using Reversible Public Key Cryptography for the Financial Services Industry (rDSA).

### d. ANS X9.62-2005, Public Key Cryptography for the Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA).

### e. ANS X9.80, Prime Number Generation, Primality Testing and Primality Certificates.

### f. Public Key Cryptography Standard (PKCS) #1, RSA Encryption Standard.

### g. Special Publication (SP) 800-57, Recommendation for Key Management.

### h. Special Publication (SP) 800-89, Recommendation for Obtaining Assurances for Digital Signature Applications.

### i. Special Publication (SP) 800-90A, Recommendation for Random Number Generation Using Deterministic Random Bit Generators.

### j. Special Publication (SP) 800-102, Recommendation for Digital Signature Timeliness.

### k. Special Publication (SP) 800-131A, Transitions: Recommendation for Transitioning the Use of Cryptographic Algorithms and Key Lengths.

### l. IEEE Std. 1363-2000, Standard Specifications for Public Key Cryptography.

**15. Qualifications: The security of a digital signature system is dependent on maintaining the ** **secrecy of the signatory’s private keys. Signatories shall, therefore, guard against the disclosure ** of their private keys. While it is the intent of this Standard to specify general security

### requirements for generating digital signatures, conformance to this Standard does not assure that

### a particular implementation is secure. It is the responsibility of an implementer to ensure that any module that implements a digital signature capability is designed and built in a secure manner.

### Similarly, the use of a product containing an implementation that conforms to this Standard does not guarantee the security of the overall system in which the product is used. The responsible **authority in each agency or department shall assure that an overall implementation provides an ** acceptable level of security.

### Since a standard of this nature must be flexible enough to adapt to advancements and

### innovations in science and technology, this Standard will be reviewed every five years in order to assess its adequacy.

**16. Waiver Procedure: The Federal Information Security Management Act (FISMA) does not ** allow for waivers to Federal Information Processing Standards (FIPS) that are made mandatory by the Secretary of Commerce.

**17. Where to Obtain Copies of the Standard: This publication is available by accessing **

### http://csrc.nist.gov/publications/. Other computer security publications are available at the same

### web site.

**Table of Contents **

**1.** **INTRODUCTION ... 1**

**2.** **GLOSSARY OF TERMS, ACRONYMS AND MATHEMATICAL SYMBOLS ... 2**

2.1 TERMS AND DEFINITIONS ... 2

2.2 ACRONYMS ... 5

2.3 MATHEMATICAL SYMBOLS ... 6

**3.** **GENERAL DISCUSSION ... 9**

3.1 INITIAL SETUP ... 11

3.2 DIGITAL SIGNATURE GENERATION ... 12

3.3 DIGITAL SIGNATURE VERIFICATION AND VALIDATION ... 13

**4** **THE DIGITAL SIGNATURE ALGORITHM (DSA) ... 15**

4.1 DSAPARAMETERS ... 15

4.2 SELECTION OF PARAMETER SIZES AND HASH FUNCTIONS FOR DSA ... 15

4.3 DSADOMAIN PARAMETERS ... 16

4.3.1 Domain Parameter Generation ... 17

4.3.2 Domain Parameter Management ... 17

4.4 KEY PAIRS ... 17

4.4.1 DSA Key Pair Generation ... 17

4.4.2 Key Pair Management ... 18

4.5 DSAPER-MESSAGE SECRET NUMBER ... 18

4.6 DSASIGNATURE GENERATION ... 19

4.7 DSASIGNATURE VERIFICATION AND VALIDATION ... 19

**5.** **THE RSA DIGITAL SIGNATURE ALGORITHM ... 22**

5.1 RSAKEY PAIR GENERATION ... 22

5.2 KEY PAIR MANAGEMENT ... 23

5.3 ASSURANCES ... 23

5.4 ANSX9.31 ... 24

5.5 PKCS#1 ... 24

**6. THE ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM (ECDSA) ... 26**

6.1 ECDSADOMAIN PARAMETERS ... 26

6.1.1 Domain Parameter Generation ... 26

6.1.2 Domain Parameter Management ... 28

6.2 PRIVATE/PUBLIC KEYS ... 28

6.2.1 Key Pair Generation ... 29

6.2.2 Key Pair Management ... 29

6.3 SECRET NUMBER GENERATION ... 29

6.4 ECDSADIGITAL SIGNATURE GENERATION AND VERIFICATION ... 29

6.5 ASSURANCES ... 30

**APPENDIX A: GENERATION AND VALIDATION OF FFC DOMAIN PARAMETERS ... 31**

A.1 GENERATION OF THE FFCP*RIMES P AND Q* ... 31

A.1.1 Generation and Validation of Probable Primes ... 31

A.1.2 *Construction and Validation of the Provable Primes p and q ... 36*

A.2 GENERATION OF THE G*ENERATOR G* ... 41

A.2.1 *Unverifiable Generation of the Generator g ... 41*

A.2.2 *Assurance of the Validity of the Generator g ... 42*

A.2.3 *Verifiable Canonical Generation of the Generator g ... 42*

A.2.4 *Validation Routine when the Canonical Generation of the Generator g Routine Was *
Used ... 44

**APPENDIX B: KEY PAIR GENERATION ... 46**

B.1 FFCKEY PAIR GENERATION ... 46

B.1.1 Key Pair Generation Using Extra Random Bits ... 46

B.1.2 Key Pair Generation by Testing Candidates ... 47

B.2 FFCPER-MESSAGE SECRET NUMBER GENERATION ... 48

B.2.1 Per-Message Secret Number Generation Using Extra Random Bits ... 49

B.2.2 Per-Message Secret Number Generation by Testing Candidates ... 49

B.3 IFCKEY PAIR GENERATION ... 50

B.3.1 Criteria for IFC Key Pairs ... 50

B.3.2 Generation of Random Primes that are Provably Prime ... 53

B.3.3 Generation of Random Primes that are Probably Prime ... 55

B.3.4 Generation of Provable Primes with Conditions Based on Auxiliary Provable Primes .. 56

B.3.5 Generation of Probable Primes with Conditions Based on Auxiliary Provable Primes .. 58

B.3.6 Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes .. 60

B.4 ECCKEY PAIR GENERATION ... 61

B.4.1 Key Pair Generation Using Extra Random Bits ... 62

B.4.2 Key Pair Generation by Testing Candidates ... 63

B.5 ECCPER-MESSAGE SECRET NUMBER GENERATION ... 64

B.5.1 Per-Message Secret Number Generation Using Extra Random Bits ... 64

B.5.2 Per-Message Secret Number Generation by Testing Candidates ... 65

**APPENDIX C: GENERATION OF OTHER QUANTITIES ... 67**

C.1 COMPUTATION OF THE INVERSE VALUE ... 67

C.2 CONVERSION BETWEEN BIT STRINGS AND INTEGERS ... 68

C.2.1 Conversion of a Bit String to an Integer ... 68

C.2.2 Conversion of an Integer to a Bit String ... 68

C.3 PROBABILISTIC PRIMALITY TESTS ... 69

C.3.1 Miller-Rabin Probabilistic Primality Test ... 71

C.3.2 Enhanced Miller-Rabin Probabilistic Primality Test ... 72

C.3.3(GENERAL)LUCAS PROBABILISTIC PRIMALITY TEST ... 74

C.4 CHECKING FOR A PERFECT SQUARE ... 75

C.5 JACOBI SYMBOL ALGORITHM ... 76

C.6 SHAWE-TAYLOR RANDOM_PRIME ROUTINE ... 77

C.7 TRIAL DIVISION ... 80

C.8 SIEVE PROCEDURE ... 80

C.9 COMPUTE A PROBABLE PRIME FACTOR BASED ON AUXILIARY PRIMES ... 81

C.10 CONSTRUCT A PROVABLE PRIME (POSSIBLY WITH CONDITIONS),BASED ON CONTEMPORANEOUSLY CONSTRUCTED AUXILIARY PROVABLE PRIMES ... 83

**APPENDIX D: RECOMMENDED ELLIPTIC CURVES FOR FEDERAL GOVERNMENT USE ... 87**

D.1 NISTRECOMMENDED ELLIPTIC CURVES ... 87

D.1.1 Choices ... 87

D.1.2 Curves over Prime Fields ... 89

D.1.3 Curves over Binary Fields ... 92

D.2 IMPLEMENTATION OF MODULAR ARITHMETIC ... 101

D.2.1 Curve P-192 ... 101

D.2.2 Curve P-224 ... 102

D.2.3 Curve P-256 ... 102

D.2.4 Curve P-384 ... 103

D.2.5 Curve P-521 ... 104

D.3 NORMAL BASES ... 104

D.4 SCALAR MULTIPLICATION ON KOBLITZ CURVES ... 106

D.5 GENERATION OF PSEUDO-RANDOM CURVES (PRIME CASE) ... 109

D.6 VERIFICATION OF CURVE PSEUDO-RANDOMNESS (PRIME CASE) ... 110

D.7 GENERATION OF PSEUDO-RANDOM CURVES (BINARY CASE) ... 111

D.8 VERIFICATION OF CURVE PSEUDO-RANDOMNESS (BINARY CASE) ... 111

D.9 POLYNOMIAL BASIS TO NORMAL BASIS CONVERSION ... 112

D.10 NORMAL BASIS TO POLYNOMIAL BASIS CONVERSION ... 113

**APPENDIX E: A PROOF THAT V = R IN THE DSA ... 115**

**APPENDIX F: CALCULATING THE REQUIRED NUMBER OF ROUNDS OF TESTING USING THE **
**MILLER-RABIN PROBABILISTIC PRIMALITY TEST ... 117**

F.1 THE REQUIRED NUMBER OF ROUNDS OF THE MILLER-RABIN PRIMALITY TESTS ... 117

F.2 GENERATING DSAPRIMES ... 118

F.3 GENERATING PRIMES FOR RSASIGNATURES ... 119

**APPENDIX G: REFERENCES ... 121**

**Federal Information Processing Standards Publication 186-4 **

**July 2013 **

**Specifications for the **

**DIGITAL SIGNATURE STANDARD (DSS) **

**1. ** **Introduction **

### This Standard defines methods for digital signature generation that can be used for the protection of binary data (commonly called a message), and for the verification and validation of those digital signatures. Three techniques are approved.

### (1) The Digital Signature Algorithm (DSA) is specified in this Standard. The specification includes criteria for the generation of domain parameters, for the generation of public and private key pairs, and for the generation and verification of digital signatures.

### (2) The RSA digital signature algorithm is specified in American National Standard (ANS) X9.31 and Public Key Cryptography Standard (PKCS) #1. FIPS 186-4 approves the use of implementations of either or both of these standards and specifies additional

### requirements.

### (3) The Elliptic Curve Digital Signature Algorithm (ECDSA) is specified in ANS X9.62.

### FIPS 186-4 approves the use of ECDSA and specifies additional requirements.

### Recommended elliptic curves for Federal Government use are provided herein.

### This Standard includes requirements for obtaining the assurances necessary for valid digital

### signatures. Methods for obtaining these assurances are provided in NIST Special Publication

*(SP) 800-89, Recommendation for Obtaining Assurances for Digital Signature Applications. *

**2. ** **Glossary of Terms, Acronyms and Mathematical Symbols **

**2.1 ** **Terms and Definitions **

### Approved FIPS-approved and/or NIST-recommended. An algorithm or technique that is either 1) specified in a FIPS or NIST Recommendation, or 2) adopted in a FIPS or NIST Recommendation or 3) specified in a list of NIST approved security functions.

### Assurance of domain parameter validity

### Confidence that the domain parameters are arithmetically correct.

### Assurance of possession

### Confidence that an entity possesses a private key and any associated keying material.

### Assurance of public key validity

### Confidence that the public key is arithmetically correct.

### Bit string An ordered sequence of 0’s and 1’s. The leftmost bit is the most significant bit of the string. The rightmost bit is the least significant bit of the string.

### Certificate A set of data that uniquely identifies a key pair and an owner that is authorized to use the key pair. The certificate contains the owner’s public key and possibly other information, and is digitally signed by a Certification Authority (i.e., a trusted party), thereby binding the public key to the owner.

### Certification Authority (CA)

### The entity in a Public Key Infrastructure (PKI) that is responsible for issuing certificates and exacting compliance with a PKI policy.

### Claimed signatory From the verifier’s perspective, the claimed signatory is the entity that purportedly generated a digital signature.

### Digital signature The result of a cryptographic transformation of data that, when properly implemented, provides a mechanism for verifying origin authentication, data integrity and signatory non-repudiation.

### Domain parameter seed A string of bits that is used as input for a domain parameter generation or validation process.

### Domain parameters Parameters used with cryptographic algorithms that are usually

### common to a domain of users. A DSA or ECDSA cryptographic key

### pair is associated with a specifc set of domain parameters.

### Entity An individual (person), organization, device or process. Used interchangeably with “party”.

### Equivalent process Two processes are equivalent if, when the same values are input to each process (either as input parameters or as values made available during the process or both), the same output is produced.

### Hash function A function that maps a bit string of arbitrary length to a fixed length bit string. Approved hash functions are specified in FIPS 180 and are designed to satisfy the following properties:

### 1. (One-way) It is computationally infeasible to find any input that maps to any new pre-specified output, and

### 2. (Collision resistant) It is computationally infeasible to find any two distinct inputs that map to the same output.

### Hash value See “message digest”.

### Intended signatory An entity that intends to generate digital signatures in the future.

### Key A parameter used in conjunction with a cryptographic algorithm that determines its operation. Examples applicable to this Standard include:

### 1. The computation of a digital signature from data, and 2. The verification of a digital signature.

### Key pair A public key and its corresponding private key.

### Message The data that is signed. Also known as “signed data” during the signature verification and validation process.

### Message digest The result of applying a hash function to a message. Also known as

### “hash value”.

### Non-repudiation A service that is used to provide assurance of the integrity and origin of data in such a way that the integrity and origin can be verified and validated by a third party as having originated from a specific entity in possession of the private key (i.e., the signatory).

### Owner A key pair owner is the entity that is authorized to use the private key of a key pair.

### Party An individual (person), organization, device or process. Used interchangeably with “entity”.

### Per-message secret number

### A secret random number that is generated prior to the generation of

### each digital signature.

### Public Key

### Infrastructure (PKI)

### A framework that is established to issue, maintain and revoke public key certificates.

### Prime number generation seed

### A string of random bits that is used to determine a prime number with the required characteristics.

### Private key A cryptographic key that is used with an asymmetric (public key) cryptographic algorithm. For digital signatures, the private key is uniquely associated with the owner and is not made public. The private key is used to compute a digital signature that may be verified using the corresponding public key.

### Probable prime An integer that is believed to be prime, based on a probabilistic primality test. There should be no more than a negligible probability that the so-called probable prime is actually composite.

### Provable prime An integer that is either constructed to be prime or is calculated to be prime using a primality-proving algorithm.

### Pseudorandom A process or data produced by a process is said to be pseudorandom when the outcome is deterministic, yet also effectively random as long as the internal action of the process is hidden from observation. For cryptographic purposes, “effectively” means “within the limits of the intended security strength.”

### Public key A cryptographic key that is used with an asymmetric (public key) cryptographic algorithm and is associated with a private key. The public key is associated with an owner and may be made public. In the case of digital signatures, the public key is used to verify a digital signature that was signed using the corresponding private key.

### Security strength A number associated with the amount of work (that is, the number of operations) that is required to break a cryptographic algorithm or system. Sometimes referred to as a security level.

**Shall ** Used to indicate a requirement of this Standard.

**Should ** Used to indicate a strong recommendation, but not a requirement of this Standard.

### Signatory The entity that generates a digital signature on data using a private key.

### Signature generation The process of using a digital signature algorithm and a private key to

### generate a digital signature on data.

### Signature validation The (mathematical) verification of the digital signature and obtaining the appropriate assurances (e.g., public key validity, private key possession, etc.).

### Signature verification The process of using a digital signature algorithm and a public key to verify a digital signature on data.

### Signed data The data or message upon which a digital signature has been computed. Also, see “message”.

### Subscriber An entity that has applied for and received a certificate from a Certificate Authority.

### Trusted third party (TTP)

### An entity other than the owner and verifier that is trusted by the owner or the verifier or both. Sometimes shortened to “trusted party”.

### Verifier The entity that verifies the authenticity of a digital signature using the public key.

**2.2 ** **Acronyms **

### ANS American National Standard.

### CA Certification Authority.

### DSA Digital Signature Algorithm; specified in this Standard.

### ECDSA Elliptic Curve Digital Signature Algorithm; specified in ANS X9.62.

### FIPS Federal Information Processing Standard.

### NIST National Institute of Standards and Technology.

### PKCS Public Key Cryptography Standard.

### PKI Public Key Infrastructure.

### RBG Random Bit Generator.

### RSA Algorithm developed by Rivest, Shamir and Adleman; specified in ANS X9.31 and PKCS #1.

### SHA Secure Hash Algorithm; specified in FIPS 180.

### SP NIST Special Publication

### TTP Trusted Third Party.

**2.3 ** **Mathematical Symbols **

*a mod n * *The unique remainder r, 0 ≤ r ≤ (n – 1), when integer a is divided by * *the positive integer n. For example, 23 mod 7 = 2. *

*b ≡ a mod n * *There exists an integer k such that b – a = kn; equivalently, a mod n *

*= b mod n. *

*counter * The counter value that results from the domain parameter generation process when the domain parameter seed is used to generate DSA domain parameters.

*d * 1. For RSA, the private signature exponent of a private key.

### 2. For ECDSA, the private key.

*domain_parameter_seed A seed used for the generation of domain parameters. *

*e * The public verification exponent of an RSA public key.

*g * *One of the DSA domain parameters; g is a generator of the q-order * cyclic group of GF(

*p*

### )*; that is, an element of order

*q*

### in the

### multiplicative group of GF(

*p*

### ).

**GCD (a, b) ** *Greatest common divisor of the integers a and b. *

**GCD (a, b)**

**Hash (M) ** The result of a hash computation (message digest or hash value) on *message M using an approved hash function. *

**Hash (M)**

*index * *A value used in the generation of g to indicate its intended use (e.g., * for digital signatures).

*k * For DSA and ECDSA, a per-message secret number.

*L * *For DSA, the length of the parameter p in bits. *

*(L, N) * *The associated pair of length parameters for a DSA key pair, where L * *is the length of p, and N is the length of q. *

**LCM (a, b) ** *The least common multiple of the integers a and b. *

**LCM (a, b)**

**len (a) ** *The length of a in bits; the integer L, where 2*

**len (a)**

^{L-1}### ≤ a < 2

^{L}### .

*M * The message that is signed using the digital signature algorithm.

*m * For ECDSA, the degree of the finite field *GF*

_{2}

*m*

### .

*N * *For DSA, the length of the parameter q in bits. *

*n * *1. For RSA, the modulus; the bit length of n is considered to be the * key size.

### 2. For ECDSA, the order of the base point of the elliptic curve; the *bit length of n is considered to be the key size. *

*(n, d) * *An RSA private key, where n is the modulus, and d is the private * signature exponent.

*(n, e) * *An RSA public key, where n is the modulus, and e is the public * verification exponent.

*nlen * *The length of the RSA modulus n in bits. *

*p * 1. For DSA, one of the DSA domain parameters; a prime number that defines the Galois Field GF(

*p*

### ) and is used as a modulus in the operations of GF(

*p*

### ).

*2. For RSA, a prime factor of the modulus n. *

*q * 1. For DSA, one of the DSA domain parameters; a prime factor of *p – 1. *

*2. For RSA, a prime factor of the modulus n. *

*Q * An ECDSA public key.

*r * One component of a DSA or ECDSA digital signature. See the *definition of (r, s). *

*(r, s) * *A DSA or ECDSA digital signature, where r and s are the digital * signature components.

*s * One component of a DSA or ECDSA digital signature. See the *definition of (r, s). *

*seedlen * *The length of the domain_parameter_seed in bits. *

*SHAx(M) * The result when

*M*

* is the input to the SHA-x hash function, where * *SHA-x is specified in FIPS 180. *

*x * The DSA private key.

*y * The DSA public key.

### ⊕ Bitwise logical “exclusive-or” on bit strings of the same length; for corresponding bits of each bit string, the result is determined as follows: 0 ⊕ 0 = 0, 0 ⊕ 1 = 1, 1 ⊕ 0 = 1, or 1 ⊕ 1 = 0.

### Example: 01101 ⊕ 11010 = 10111

+

### Addition.

### ∗ Multiplication.

### / Division.

*a || b * *The concatenation of two strings a and b. Either a and b are both bit * strings, or both are byte strings.

*a * *The ceiling of a: the smallest integer that is greater than or equal to * *a. For example, 5 = 5, 5.3 = 6, and –2.1 = –2. *

*a * *The floor of a; the largest integer that is less than or equal to a. For * example, 5 = 5, 5.3 = 5, and -2.1. = -3.

*|a| * *The absolute value of a; |a| is – a if a < 0; otherwise, it is simply a. *

### For example, |2| = 2, and |–2| = 2.

*[a, b] * *The interval of integers between and including a and b. For example, * [1, 4] consists of the integers 1, 2, 3 and 4.

*{, a, b, …* } Used to indicate optional information.

### 0x The prefix to a bit string that is represented in hexadecimal characters.

**3. ** **General Discussion **

### A digital signature is an electronic analogue of a written signature; the digital signature can be used to provide assurance that the claimed signatory signed the information. In addition, a digital signature may be used to detect whether or not the information was modified after it was signed (i.e., to detect the integrity of the signed data). These assurances may be obtained whether the data was received in a transmission or retrieved from storage. A properly implemented digital signature algorithm that meets the requirements of this Standard can provide these services.

### A digital signature algorithm includes a signature generation process and a signature verification process. A signatory uses the generation process to generate a digital signature on data; a verifier uses the verification process to verify the authenticity of the signature. Each signatory has a public and private key and is the owner of that key pair. As shown in Figure 1, the private key is used in the signature generation process. The key pair owner is the only entity that is authorized to use the private key to generate digital signatures. In order to prevent other entities from

### claiming to be the key pair owner and using the private key to generate fraudulent signatures, the **Private**

**Private**

**Key**

**Key**

**Public** **Signature ** **Key**

**Public**

**Key**

**Generation** **Message/Data**

**Message/Data**

**Signature ** **Verification** **Message/Data**

**Message/Data**

**Hash Function**

**Hash Function** **Hash Function** **Hash Function**

**Message Digest** **Message Digest**

**Message Digest**

**Message Digest**

**Signature Generation** **Signature Verification**

**Signature**

**Signature**

**Valid or** **Invalid**

**Figure 1: Digital Signature Processes **

### private key must remain secret. The approved digital signature algorithms are designed to prevent an adversary who does not know the signatory’s private key from generating the same signature as the signatory on a different message. In other words, signatures are designed so that they cannot be forged. A number of alternative terms are used in this Standard to refer to the signatory or key pair owner. An entity that intends to generate digital signatures in the future *may be referred to as the intended signatory. Prior to the verification of a signed message, the * *signatory is referred to as the claimed signatory until such time as adequate assurance can be * obtained of the actual identity of the signatory.

### The public key is used in the signature verification process (see Figure 1). The public key need not be kept secret, but its integrity must be maintained. Anyone can verify a correctly signed message using the public key.

### For both the signature generation and verification processes, the message (i.e., the signed data) is converted to a fixed-length representation of the message by means of an approved hash

### function. Both the original message and the digital signature are made available to a verifier.

### A verifier requires assurance that the public key to be used to verify a signature belongs to the entity that claims to have generated a digital signature (i.e., the claimed signatory). That is, a verifier requires assurance that the signatory is the actual owner of the public/private key pair used to generate and verify a digital signature. A binding of an owner’s identity and the owner’s **public key shall be effected in order to provide this assurance. **

### A verifier also requires assurance that the key pair owner actually possesses the private key associated with the public key, and that the public key is a mathematically correct key.

### By obtaining these assurances, the verifier has assurance that if the digital signature can be correctly verified using the public key, the digital signature is valid (i.e., the key pair owner really signed the message). Digital signature validation includes both the (mathematical) verification of the digital signature and obtaining the appropriate assurances. The following are reasons why such assurances are required.

### 1. If a verifier does not obtain assurance that a signatory is the actual owner of the key pair whose public component is used to verify a signature, the problem of forging a signature is reduced to the problem of falsely claiming an identity. For example, anyone in

### possession of a mathematically consistent key pair can sign a message and claim that the signatory was the President of the United States. If a verifier does not require assurance that the President is actually the owner of the public key that is used to mathematically verify the message’s signature, then successful signature verification provides assurance that the message has not been altered since it was signed, but does not provide assurance that the message came from the President (i.e., the verifier has assurance of the data’s integrity, but source authentication is lacking).

### 2. If the public key used to verify a signature is not mathematically valid, the arguments

### used to establish the cryptographic strength of the signature algorithm may not apply.

### The owner may not be the only party who can generate signatures that can be verified with that public key.

### 3. If a public key infrastructure cannot provide assurance to a verifier that the owner of a key pair has demonstrated knowledge of a private key that corresponds to the owner’s public key, then it may be possible for an unscrupulous entity to have their identity (or an assumed identity) bound to a public key that is (or has been) used by another party. The unscrupulous entity may then claim

### to be the source of certain messages signed by that other party. Or, it may be possible that an

### unscrupulous entity has managed to obtain ownership of a public key that was chosen with the sole purpose of allowing for the verification of a signature on a specific message.

### Technically, a key pair used by a digital signature algorithm could also be used for purposes other than digital signatures (e.g., for key establishment). However, a key pair used for digital signature generation and verification as specified in this Standard **shall not be used for any other purpose. See ** SP 800-57 on Key Usage for further

### information.

### A number of steps are required to enable a digital signature generation or verification capability in accordance with this Standard.

### All parties that generate digital signatures **shall perform the initial setup process as ** discussed in Section 3.1. Digital signature **generation shall be performed as discussed ** in Section 3.2. Digital signature verification **and validation shall be performed as **

### discussed in Section 3.3.

**3.1 ** **Initial Setup **

### Figure 2 depicts the steps that are performed prior to generating a digital

**Obtain**
**Assurance of Possession**

**of the **
**DS Private Key**

**Obtain**
**Assurance of Possession**

**of the **
**DS Private Key**

**Obtain**
**Assurance of**
**Public Key Validity**

**Obtain**
**Assurance of**
**Public Key Validity**

**Obtain**
**DS Key Pair**

**Obtain**
**DS Key Pair**
**Obtain Assurance of**

**Domain Parameter **
**Validity**
**Obtain Assurance of**

**Domain Parameter **
**Validity**
**Obtain**
**Domain Parameters**

**Obtain**
**Domain Parameters**

**Intended Signatory Ready for **
**Generating Digital Signatures**
**Intended**

**signatory**
**OR**
**another**
**entity**
**generates**

**Intended**
**signatory**
**OR **
**a TTP**
**generates**

**Register the Public Key **
**and Identity with a **

**TTP**
**Optional**

**DSA**
**and **
**ECDSA**

**Figure 2: Initial Setup by an Intended **

**Signatory **

### signature by an entity intending to act as a signatory.

**For the DSA and ECDSA algorithms, the intended signatory shall first obtain appropriate ** domain parameters, either by generating the domain parameters itself, or by obtaining domain parameters that another entity has generated. Having obtained the set of domain parameters, the **intended signatory shall obtain assurance of the validity of those domain parameters; approved ** methods for obtaining this assurance are provided in SP 800-89. Note that the RSA algorithm does not use domain parameters.

**Each intended signatory shall obtain a digital signature key pair that is generated as specified for ** the appropriate digital signature algorithm, either by generating the key pair itself or by

### obtaining the key pair from a trusted party. The intended signatory is authorized to use the key pair and is the owner of that key pair. Note that if a trusted party generates the key pair, that party needs to be trusted not to masquerade as the owner, even though the trusted party knows the private key.

**After obtaining the key pair, the intended signatory (now the key pair owner) shall obtain (1) ** assurance of the validity of the public key and (2) assurance that he/she actually possesses the associated private key. Approved methods for obtaining these assurances are provided in SP 800-89.

### A digital signature verifier requires assurance of the identity of the signatory. Depending on the environment in which digital signatures are generated and verified, the key pair owner (i.e., the intended signatory) may register the public key and establish proof of identity with a mutually trusted party. For example, a certification authority (CA) could sign credentials containing an owner’s public key and identity to form a certificate after being provided with proof of the owner’s identity. Systems for certifying

### credentials and distributing certificates are beyond the scope of this Standard. Other means of establishing proof of identity (e.g., by

### providing identity credentials along with the public key directly to a prospective verifier) are allowed.

**3.2 ** **Digital Signature Generation ** Figure 3 depicts the steps that are performed by an intended signatory (i.e., the entity that generates a digital signature).

### Prior to the generation of a digital signature, a **message digest shall be generated on the ** information to be signed using an appropriate approved hash function.

**Generate a Digital Signature**
**Obtain Additional **
**Information for the **
**Digital Signature Process**

**Obtain Additional **
**Information for the **
**Digital Signature Process**

**Digital Signature Generation Complete**
**DSA **

**and **
**ECDSA**

**Generate a Message Digest**

**Verify the Digital Signature**
**Optional**

**Depending on the digital signature algorithm to be used, additional information shall be ** **obtained. For example, a random per-message secret number shall be obtained for DSA and ** ECDSA.

### Using the selected digital signature algorithm, the signature private key, the message digest, and **any other information required by the digital signature process, a digital signature shall be ** generated in accordance with this Standard.

### The signatory may optionally verify the digital signature using the signature verification process and the associated public key. This optional verification serves as a final check to detect

### otherwise undetected signature generation computation errors; this verification may be prudent when signing a high-value message, when multiple users are expected to verify the signature, or if the verifier will be verifying the signature at a much later time.

**3.3 ** **Digital Signature Verification and Validation **

### Figure 4 depicts the digital signature verification and validation process that are performed by a verifier (e.g., the intended recipient of the signed data and associated digital signature). Note that the figure depicts a successful verification and validation process (i.e., no errors are detected).

**In order to verify a digital signature, the verifier shall obtain the public key of the claimed ** signatory, (usually) based on the claimed identity. If DSA or ECDSA has been used to generate **the digital signature, the verifier shall also obtain the domain parameters. The public key and ** domain parameters may be obtained, for example, from a certificate created by a trusted party **(e.g., a CA) or directly from the claimed signatory. A message digest shall be generated on the ** data whose signature is to be verified (i.e., not on the received digital signature) using the same hash function that was used during the digital signature generation process. Using the

### appropriate digital signature algorithm, the domain parameters (if appropriate), the public key and the newly computed message digest, the received digital signature is verified in accordance with this Standard. If the verification process fails, no inference can be made as to whether the data is correct, only that in using the specified public key and the specified signature format, the digital signature cannot be verified for that data.

**Before accepting the verified digital signature as valid, the verifier shall have (1) assurance of ** the signatory’s claimed identity, (2) assurance of the validity of the domain parameters (for DSA and ECDSA), (3) assurance of the validity of the public key, and (4) assurance that the claimed signatory actually possessed the private key that was used to generate the digital signature at the time that the signature was generated. Methods for the verifier to obtain these assurances are provided in SP 800-89. Note that assurance of domain parameter validity may have been obtained during initial setup (see Section 3.1).

### If the verification and assurance processes are successful, the digital signature and signed data

**shall be considered valid. However, if a verification or assurance process fails, the digital **

**signature should be considered invalid. An organization’s policy shall govern the action to be **

### taken for an invalid digital signature. Such policy is outside the scope of this Standard.

**Obtain the Domain ** **Parameters and Public Key**

**Get the Claimed ** **Signatory’s Identifier**

**Get the Claimed ** **Signatory’s Identifier**

**Generate a Message Digest**

**Verify the Digital Signature**

**Obtain Assurance of the Claimed ** **Signatory’s Identity**

**Obtain Assurance of Domain ** **Parameter Validity**

**Obtain Assurance of the Validity ** **of the Owner’s Public Key**

**Obtain Assurance that the Owner ** **Possesses the Private Key**

**Digital Signature Validation Complete**

**Actions** **Assurances**

**Figure 4: Digital Signature Verification and Validation **

**4 ** **The Digital Signature Algorithm (DSA) **

**4.1 ** **DSA Parameters **

*A DSA digital signature is computed using a set of domain parameters, a private key x, a per-* *message secret number k, data to be signed, and a hash function. A digital signature is verified * *using the same domain parameters, a public key y that is mathematically associated with the * *private key x used to generate the digital signature, data to be verified, and the same hash * function that was used during signature generation. These parameters are defined as follows:

*p a prime modulus, where 2*

^{L–1}* < p < 2*

^{L}*, and L is the bit length of p. Values for L are * provided in Section 4.2.

*q a prime divisor of (p – 1), where 2*

^{N–1}* < q < 2*

^{ N}*, and N is the bit length of q. Values for N * are provided in Section 4.2.

*g a generator of a subgroup of order q in the multiplicative group of GF(p), such that 1 < g *

*< p. *

*x the private key that must remain secret; x is a randomly or pseudorandomly generated * *integer, such that 0 < x < q, i.e., x is in the range [1, q–1]. *

*y the public key, where y = gx mod p. *

*k a secret number that is unique to each message; k is a randomly or pseudorandomly * *generated integer, such that 0 < k < q, i.e., k is in the range [1, q–1]. *

**4.2 ** **Selection of Parameter Sizes and Hash Functions for DSA **

*This Standard specifies the following choices for the pair L and N (the bit lengths of p and q, * respectively):

*L = 1024, N = 160 * *L = 2048, N = 224 * *L = 2048, N = 256 * *L = 3072, N = 256 *

**Federal Government entities shall generate digital signatures using use one or more of these ** choices.

**An approved hash function, as specified in FIPS 180, shall be used during the generation of **

### digital signatures. The security strength associated with the DSA digital signature process is no

*greater than the minimum of the security strength of the (L, N) pair and the security strength of *

### the hash function that is employed. Both the security strength of the hash function used and the

**security strength of the (L, N) pair shall meet or exceed the security strength required for the **

**security strength of the (L, N) pair shall meet or exceed the security strength required for the**

*digital signature process. The security strength for each (L, N) pair and hash function is provided * in SP 800-57.

*SP 800-57 provides information about the selection of the appropriate (L, N) pair in accordance * with a desired security strength for a given time period for the generation of digital signatures.

**An (L, N) pair shall be chosen that protects the signed information during the entire expected ** lifetime of that information. For example, if a digital signature is generated in 2009 for

**An (L, N) pair shall be chosen that protects the signed information during the entire expected**

*information that needs to be protected for five years, and a particular (L, N) pair is invalid after * **2010, then a larger (L, N) pair shall be used that remains valid for the entire period of time that ** the information needs to be protected.

**2010, then a larger (L, N) pair shall be used that remains valid for the entire period of time that**

*It is recommended that the security strength of the (L, N) pair and the security strength of the * hash function used for the generation of digital signatures be the same unless an agreement has been made between participating entities to use a stronger hash function. When the length of the *output of the hash function is greater than N (i.e., the bit length of q), then the leftmost N bits of * **the hash function output block shall be used in any calculation using the hash function output ** during the generation or verification of a digital signature. A hash function that provides a lower **security strength than the (L, N) pair ordinarily should not be used, since this would reduce the ** security strength of the digital signature process to a level no greater than that provided by the hash function.

**security strength than the (L, N) pair ordinarily should not be used, since this would reduce the**

**A Federal Government entity other than a Certification Authority (CA) should use only the first ** **three (L, N) pairs (i.e., the (1024, 160), (2048, 224) and (2048, 256) pairs). A CA shall use an (L, ** *N) pair that is equal to or greater than the (L, N) pairs used by its subscribers. For example, if * **subscribers are using the (2048, 224) pair, then the CA shall use either the (2048, 224), (2048, ** 256) or (3072, 256) pair. Possible exceptions to this rule include cross certification between CAs, certifying keys for purposes other than digital signatures and transitioning from one key size or algorithm to another. See SP 800-57 for further guidance.

**three (L, N) pairs (i.e., the (1024, 160), (2048, 224) and (2048, 256) pairs). A CA shall use an (L,**

**4.3 ** **DSA Domain Parameters **

### DSA requires that the private/public key pairs used for digital signature generation and verification be generated with respect to a particular set of domain parameters. These domain parameters may be common to a group of users and may be public. A user of a set of domain **parameters (i.e., both the signatory and the verifier) shall have assurance of their validity prior to ** **using them (see Section 3). Although domain parameters may be public information, they shall ** be managed so that the correct correspondence between a given key pair and its set of domain parameters is maintained for all parties that use the key pair. A set of domain parameters may remain fixed for an extended time period.

*The domain parameters for DSA are the integers p, q, and g, and optionally, the *

*domain_parameter_seed and counter that were used to generate p and q (i.e., the full set of *

*domain parameters is (p, q, g {, domain_parameter_seed, counter})). *

**4.3.1 Domain Parameter Generation **

### Domain parameters may be generated by a trusted third party (a TTP, such as a CA) or by an **entity other than a TTP. Assurance of domain parameter validity shall be obtained prior to key ** pair generation, digital signature generation or digital signature verification (see Section 3).

**The integers p and q shall be generated as specified in Appendix A.1. The input to the ** *generation process is the selected values of L and N (see Section 4.2); the output of the * *generation process is the values for p and q, and optionally, the values of the *

**The integers p and q shall be generated as specified in Appendix A.1. The input to the**

*domain_parameter_seed and counter. *

**The generator g shall be generated as specified in Appendix A.2. **

**The generator g shall be generated as specified in Appendix A.2.**

### The security strength of a hash function used during the generation of the domain parameters **shall meet or exceed the security strength associated with the (L, N) pair. Note that this is more ** restrictive than the hash function that can be used for the digital signature process (see Section 4.2).

**shall meet or exceed the security strength associated with the (L, N) pair. Note that this is more**

**4.3.2 Domain Parameter Management **

**Each digital signature key pair shall be correctly associated with one specific set of domain ** parameters (e.g., by a public key certificate that identifies the domain parameters associated with **the public key). The domain parameters shall be protected from unauthorized modification until ** the set is deactivated (if and when the set is no longer needed). The same domain parameters may be used for more than one purpose (e.g., the same domain parameters may be used for both *digital signatures and key establishment). However, using different values for the generator g * reduces the risk that key pairs generated for one purpose could be accidentally used

### (successfully) for another purpose.

**4.4 ** **Key Pairs **

*Each signatory has a key pair: a private key x and a public key y that are mathematically related * **to each other. The private key shall be used for only a fixed period of time (i.e., the private key ** cryptoperiod) in which digital signatures may be generated; the public key may continue to be used as long as digital signatures that were generated using the associated private key need to be verified (i.e., the public key may continue to be used beyond the cryptoperiod of the associated private key). See SP 800-57 for further guidance.

**4.4.1 DSA Key Pair Generation **

*A digital signature key pair x and y is generated for a set of domain parameters (p, q, g {, *

*domain_parameter_seed, counter}). Methods for the generation of x and y are provided in *

### Appendix B.1.

**4.4.2 Key Pair Management **

### Guidance on the protection of key pairs is provided in SP 800-57. The secure use of digital signatures depends on the management of an entity’s digital signature key pair as follows:

** 1. The validity of the domain parameters shall be assured prior to the generation of the key ** **pair, or the verification and validation of a digital signature (see Section 3). **

**2. Each key pair shall be associated with the domain parameters under which the key pair ** was generated.

**3. A key pair shall only be used to generate and verify signatures using the domain ** parameters associated with that key pair.

**4. The private key shall be used only for signature generation as specified in this Standard ** **and shall be kept secret; the public key shall be used only for signature verification and ** may be made public.

**5. An intended signatory shall have assurance of possession of the private key prior to or ** concurrently with using it to generate a digital signature (see Section 3.1).

**6. A private key shall be protected from unauthorized access, disclosure and modification. **

**7. A public key shall be protected from unauthorized modification (including substitution). **

### For example, public key certificates that are signed by a CA may provide such protection.

**8. A verifier shall be assured of a binding between the public key, its associated domain ** parameters and the key pair owner (see Section 3).

**9. A verifier shall obtain public keys in a trusted manner (e.g., from a certificate signed by a ** CA that the entity trusts, or directly from the intended or claimed signatory, provided that the entity is trusted by the verifier and can be authenticated as the source of the signed information that is to be verified).

**10. Verifiers shall be assured that the claimed signatory is the key pair owner, and that the ** owner possessed the private key that was used to generate the digital signature at the time that the signature was generated (i.e., the private key that is associated with the public key that will be used to verify the digital signature) (see Section 3.3).

**11. A signatory and a verifier shall have assurance of the validity of the public key (see ** Sections 3.1 and 3.3).

**4.5 ** **DSA Per-Message Secret Number **

**A new secret random number k shall be generated prior to the generation of each digital **

**A new secret random number k shall be generated prior to the generation of each digital**

**signature for use during the signature generation process. This secret number shall be protected ** from unauthorized disclosure and modification.

−1

*k* * is the multiplicative inverse of k with respect to multiplication modulo q; i.e., 0 < * *k*

^{−}

^{1}

* < q *

### and 1 = ( *k*

^{−}

^{1}

* k) mod q. This inverse is required for the signature generation process (see Section * 4.6). A technique is provided in Appendix C.1 for deriving *k*

^{−}

^{1}

* from k. *

*k and * *k may be pre-computed, since knowledge of the message to be signed is not required for *

^{−}

^{1}

*the computations. When k and * *k*

^{−}

^{1}

** are pre-computed, their confidentiality and integrity shall be ** protected.

### Methods for the generation of the per-message secret number are provided in Appendix B.2.

**4.6 ** **DSA Signature Generation **

**The intended signatory shall have assurances as specified in Section 3.1. **

**Let N be the bit length of q. Let min(N, outlen) denote the minimum of the positive integers N ** *and outlen, where outlen is the bit length of the hash function output block. *

**Let N be the bit length of q. Let min(N, outlen) denote the minimum of the positive integers N**

*The signature of a message M consists of the pair of numbers r and s that is computed according * to the following equations:

*r = (g*

^{k}* mod p) mod q. *

**z = the leftmost min(N, outlen) bits of Hash(M). **

**z = the leftmost min(N, outlen) bits of Hash(M).**

*s = (* *k (z + xr)) mod q. *

^{−}

^{1}

**When computing s, the string z obtained from Hash(M) shall be converted to an integer. The ** conversion rule is provided in Appendix C.2.

**When computing s, the string z obtained from Hash(M) shall be converted to an integer. The**

*Note that r may be computed whenever k, p, q and g are available, e.g., whenever the domain * *parameters p, q and g are known, and k has been pre-computed (see Section 4.5), r may also be * pre-computed, since knowledge of the message to be signed is not required for the computation *of r. Pre-computed k, k*

^{-1}

** and r values shall be protected in the same manner as the the private ** *key x until s has been computed (see SP 800-57). *

**and r values shall be protected in the same manner as the the private**

**The values of r and s shall be checked to determine if r = 0 or s = 0. If either r = 0 or s = 0, a ** **new value of k shall be generated, and the signature shall be recalculated. It is extremely ** *unlikely that r = 0 or s = 0 if signatures are generated properly. *

**The values of r and s shall be checked to determine if r = 0 or s = 0. If either r = 0 or s = 0, a**

**new value of k shall be generated, and the signature shall be recalculated. It is extremely**

*The signature (r, s) may be transmitted along with the message to the verifier. *

**4.7 ** **DSA Signature Verification and Validation **

### Signature verification may be performed by any party (i.e., the signatory, the intended recipient

### or any other party) using the signatory’s public key. A signatory may wish to verify that the

### computed signature is correct, perhaps before sending the signed message to the intended

### recipient. The intended recipient (or any other party) verifies the signature to determine its authenticity.

### Prior to verifying the signature of a signed message, the domain parameters, and the claimed **signatory’s public key and identity shall be made available to the verifier in an authenticated ** manner. The public key may, for example, be obtained in the form of a certificate signed by a trusted entity (e.g., a CA) or in a face-to-face meeting with the public key owner.

*Let M ′, r′, and s′ be the received versions of M, r, and s, respectively; let y be the public key of * **the claimed signatory; and let N be the bit length of q. Also, let min(N, outlen) denote the ** *minimum of the positive integers N and outlen, where outlen is the bit length of the hash * function output block.

**the claimed signatory; and let N be the bit length of q. Also, let min(N, outlen) denote the**

### The signature verification process is as follows:

**1. The verifier shall check that 0 < r′ < q and 0 < s′ < q; if either condition is violated, the ** **signature shall be rejected as invalid. **

**1. The verifier shall check that 0 < r′ < q and 0 < s′ < q; if either condition is violated, the**

### 2. If the two conditions in step 1 are satisfied, the verifier computes the following:

*w = (s′)*

^{–1}

* mod q. *

**z = the leftmost min(N, outlen) bits of Hash(M′ ). **

**z = the leftmost min(N, outlen) bits of Hash(M′ ).**

*u1 = (zw) mod q. *

*u2 = ((r′)w) mod q. *

*v = (((g)*

^{u1}* (y)*

^{u2}*) mod p) mod q. *

*A technique is provided in Appendix C.1 for deriving (s′ )*

^{–1}### (i.e., the multiplicative *inverse of s′ mod q). *

**The string z obtained from Hash(M′) shall be converted to an integer. The conversion ** rule is provided in Appendix C.2.

**The string z obtained from Hash(M′) shall be converted to an integer. The conversion**