Sign the data, using SH_SHA1, pointed to by pInData given the key and the key type set in setKey.
setKey() must be called at least once before this function is called. This method is defined to work with only a DSA cipher and a call to the setKey() method must be called before this function. Note that the sign() and verify() methods defined above can also be used for DSA signatures. However, this method provides the DSA signature result back in its 'raw' form as 2 160-bit integers.
A data source can be a buffer or a file. A data source can be text or binary data. The resulting signature is represented in DSA raw form of two 160-bit integers r and s returned in network byte order.
- Parameters
-
pInData | [ in ] Generate a signature for this input data. |
pR | [ out ] Binary value, 160-bit integer half of the DSA signature. If this paramter is set to NULL, then the required buffer sizes are placed in both pRLength and pSLength. |
pRLength | [INOUT] On input this parameter contains the size in bytes of the buffer pointed to by pR. On output this parameter contains the number of bytes that where written into pR. If eTooSmall error is returned then this parameter returnes the required size of the buffer pointed by pR. |
pS | [ out ] Binary value, 160-bit integer half of the DSA signature. If this paramter is set to NULL, then the required buffer sizes are placed in both pRLength and pSLength. |
pSLength | [INOUT] On input this parameter contains the size in bytes of the buffer pointed to by pS. On output this parameter contains the number of bytes that where written into pS. If eTooSmall error is returned then this parameter returnes the required size of the buffer pointed by pS. |
- Returns
Success | P6R::eOk | |
Failure | eNotInitialized | A successful call to initialize was not made before this call. |
eFormatError | A DSA private key has not been loaded via loadDSAKeyPair. |
eInvalidArg | One of the parameters is NULL. |
eNotFound | File data source does not exist. |
eIoError | Write to file data sink failed. |
eTooSmall | The buffer data sink is too small to contain the generated value. |
eTooBig | Internal error |
eMissingKey | setKey must be called before this function. |
eWrongKeyClass | Private or symetric keys only can sign data. |
eFailAndException | The signature calculation failed. Exception record provides detailed error info. |