Sign Method

Signs a message using a key.

Syntax

ANSI (Cross Platform)
int Sign(const char* lpszKeyName, const char* lpszVersionId, const char* lpszAlgorithm, int bIsDigest);

Unicode (Windows)
INT Sign(LPCWSTR lpszKeyName, LPCWSTR lpszVersionId, LPCWSTR lpszAlgorithm, BOOL bIsDigest);
- (void)sign:(NSString*)keyName :(NSString*)versionId :(NSString*)algorithm :(BOOL)isDigest;
#define MID_GOOGLEKMS_SIGN 26

CLOUDKEYS_EXTERNAL int CLOUDKEYS_CALL CloudKeys_GoogleKMS_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method signs a message using the asymmetric key version specified by KeyName and VersionId.

The message data to sign is taken from the input stream supplied via the SetInputStream method, the specified InputFile, or the InputData property. The signature data is output to the output stream supplied via the SetOutputStream method, the specified OutputFile, or the OutputData property.

The Algorithm parameter specifies the hash algorithm used to generate a message digest; this must be the same algorithm that appears in the key version's VersionAlgorithm string. The value passed must contain one of the following strings (passing the key version's complete algorithm string is acceptable):

  • SHA256
  • SHA384
  • SHA512

The IsDigest parameter specifies whether the message data is the original message (false) or a message digest (true). When supplying a message digest, keep in mind that the same digest will need to be provided in order to Verify the signature later.

If IsDigest is false, the class will automatically compute an appropriate message digest before the request is made. In such cases, the computed digest is made available via the MessageDigest configuration setting.

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
Cloud Keys 2020 C++ Edition - Version 20.0 [Build 8157]