Discuss this help topic in SecureBlackbox Forum

TElX509CertificateEx.Sign

TElX509CertificateEx     See also     


Filter: C#/Java  VB.NET  Pascal  C++  PHP  


Signs the input data with certificate's private key.

Declaration

[C#/Java]
    bool Sign(byte[] InBuffer, ref byte[] OutBuffer, ref int OutSize, bool Detached, bool IncludeCertificates);
    bool Sign(byte[] InBuffer, int InStartIndex, int InCount, byte[] OutBuffer, int OutStartIndex, ref int OutCount, bool Detached, bool IncludeCertificates);

[VB.NET]
    Function Sign(ByVal InBuffer As Byte(), ByRef OutBuffer As Byte(), ByRef OutSize As Integer, ByVal Detached As Boolean, ByVal IncludeCertificates As Boolean) As Boolean
    Function Sign(ByVal InBuffer As Byte(), ByVal InStartIndex As Integer, ByVal InCount As Integer, ByVal OutBuffer As Byte(), ByVal OutStartIndex As Integer, ByRef OutCount As Integer, ByVal Detached As Boolean, ByVal IncludeCertificates As Boolean) As Boolean

[Pascal]
    function Sign( InBuffer : pointer; InSize : integer; OutBuffer : pointer; var OutSize : integer; Detached : boolean = false; IncludeCertificates : boolean = true) : boolean;

[C++]
    bool Sign(void * InBuffer, int32_t InSize, void * OutBuffer, int32_t &OutSize, bool Detached, bool IncludeCertificates);

[PHP]
    bool Sign(TSBPointer|array of byte|string|NULL $InBuffer, integer $InSize, TSBPointer|array of byte|string|NULL $OutBuffer, integer &$OutSize, bool $Detached, bool $IncludeCertificates)

Parameters

  • InBuffer - should contain the data which should be signed
  • InSize - the size of Buffer in bytes
  • OutBuffer - buffer where calculated digital signature should be written
  • OutSize - specifies the size of OutBuffer.
  • Detached - specifies whether the detached signature should be created
  • IncludeCertificates - specifies whether certificate is included into signature
  • InStartIndex - the start position in the InBuffer from which the data must be read.
  • InCount - number of bytes to be read.
  • OutStartIndex - the start position in the OutBuffer from which the data must be written.
  • OutCount - number of bytes to be written.

Return value

    Returns True if the signature is successfully written to OutBuffer, and False if OutBuffer is too small.
    In both cases, the OutSize parameter value is set to the actual size of signature length.

Description

    This method causes TElX509CertificateEx object to sign the data contained in the InBuffer with its private key.
    TElX509CertificateEx object should contain the private key corresponding to this certificate. If private key is absent, the EElCertificateException is raised.
    If Detached parameter is set to True, the so-called detached signature is created. Detached signature file does not contain the original message itself, so the original message has to be transported along with its signature. If the Detached parameter is False, the original message is included in signature file.
    By default the certificates, used for signing, are included into signature. Then, when the Verify method is called, these certificates are used in verification. This can confuse, since Verify method is called for one certificate, and instead other certificates are used. To avoid this, set IncludeCertificates to False.

See also:     Verify    

Discuss this help topic in SecureBlackbox Forum