CryptoManager.Sign

Syntax variant: Signature data in return value

Syntax:

Sign(<InitialData>, <Certificate>)

Parameters:

<InitialData> (required)

Type: String: BinaryData.
Initial data to sign.
Data can be located in file (in this case the file name is specified) or represented as BinaryData.

<Certificate> (optional)

Type: CryptoCertificate.
Used cryptography certificate.
If not specified, the store of personal certificates must contain exactly one certificate. Otherwise, an exception is generated.

Syntax variant: Signature data are saved to file

Syntax:

Sign(<InitialData>, <OutputData>, <Certificate>)

Parameters:

<InitialData> (required)

Type: String: BinaryData.
Initial data to sign.
Data can be located in file (in this case the file name is specified) or represented as BinaryData.

<OutputData> (required)

Type: String.
Name of file, to which the signed data is downloaded.

<Certificate> (optional)

Type: CryptoCertificate.
Used cryptography certificate.
If not specified, the store of personal certificates must contain exactly one certificate. Otherwise, an exception is generated.

Description of method variant:

Signed data are written to a file. Returns Undefined.

Returned value:

Type: Undefined; BinaryData.
When saving signature to file returns Undefined.

Description:

Creates the signature in PKCS#7 format and returns it as BinaryData or saves it to the file.
Signature is created by algorithms, which are set by properties HashAlgorithm and SignAlgorithm.
Source file is not included in signature data.
The certificates can be included in signature data depending on the property IncludeCertificatesInSignature.
If the certificate is not indicated, the only installed personal certificate is used for the signature.

Availability:

Thin client, web-client, server, thick client, external connection.

Note:

It comes out error situation when personal certificates are not installed.
It comes out error situation when certificate used for signature is not linked with the key container.

See also:

CryptoManager, method BeginSigning

    

1C:Enterprise Developer's Community