Discuss this help topic in SecureBlackbox Forum

TElMessageEncryptor.Encrypt

TElMessageEncryptor     See also     


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


Encrypts the block of data

Declaration

[C#/Java]
    int Encrypt(byte[] InBuffer, ref byte[] OutBuffer, ref int OutSize);
    int Encrypt(byte[] InBuffer, ref byte[] OutBuffer, ref int OutSize, byte[] Key);
    int Encrypt(byte[] InBuffer, int InStartIndex, int InSize, byte[] OutBuffer, int OutStartIndex, ref int OutSize);
    int Encrypt(byte[] InBuffer, int InStartIndex, int InSize, byte[] OutBuffer, int OutStartIndex, ref int OutSize, byte[] Key);
    int Encrypt(System.IO.Stream InStream, System.IO.Stream OutStream, long InCount);
    int Encrypt(System.IO.Stream InStream, System.IO.Stream OutStream, byte[] Key, long InCount);

[VB.NET]
    Function Encrypt(ByVal InBuffer As Byte(), ByRef OutBuffer As Byte(), ByRef OutSize As Integer) As Integer
    Function Encrypt(ByVal InBuffer As Byte(), ByRef OutBuffer As Byte(), ByRef OutSize As Integer, ByVal Key As Byte()) As Integer
    Function Encrypt(ByVal InBuffer As Byte(), ByVal InStartIndex As Integer, ByVal InSize As Integer, ByVal OutBuffer As Byte(), ByVal OutStartIndex As Integer, ByRef OutSize As Integer) As Integer
    Function Encrypt(ByVal InBuffer As Byte(), ByVal InStartIndex As Integer, ByVal InSize As Integer, ByVal OutBuffer As Byte(), ByVal OutStartIndex As Integer, ByRef OutSize As Integer, ByVal Key As Byte()) As Integer
    Function Encrypt(ByVal InStream As System.IO.Stream, ByVal OutStream As System.IO.Stream, ByVal InCount As Long) As Integer
    Function Encrypt(ByVal InStream As System.IO.Stream, ByVal OutStream As System.IO.Stream, ByVal Key As Byte(), ByVal InCount As Long) As Integer

[Pascal]
    function Encrypt(InBuffer : pointer; InSize : integer; OutBuffer : pointer; var OutSize : integer) : integer; overload;
    function Encrypt(InBuffer : pointer; InSize : integer; OutBuffer : pointer; var OutSize : integer; Key : pointer; KeySize : integer) : integer; overload;
    function Encrypt(InStream, OutStream : TStream; InCount : Int64) : integer; overload;
    function Encrypt(InStream, OutStream : TStream; Key : pointer; KeySize : integer) : integer; overload;

[C++]
    int32_t Encrypt(void * InBuffer, int32_t InSize, void * OutBuffer, int32_t &OutSize);
    int32_t Encrypt(void * InBuffer, int32_t InSize, void * OutBuffer, int32_t &OutSize, void * Key, int32_t KeySize);
    int32_t Encrypt(TStream &InStream, TStream &OutStream, int64_t InCount);
    int32_t Encrypt(TStream *InStream, TStream *OutStream, int64_t InCount);
    int32_t Encrypt(TStream &InStream, TStream &OutStream, void * Key, int32_t KeySize, int64_t InCount);
    int32_t Encrypt(TStream *InStream, TStream *OutStream, void * Key, int32_t KeySize, int64_t InCount);

[PHP]
    integer Encrypt(TSBPointer|array of byte|string|NULL $InBuffer, integer $InSize, TSBPointer|array of byte|string|NULL $OutBuffer, integer &$OutSize)
    integer Encrypt(TSBPointer|array of byte|string|NULL $InBuffer, integer $InSize, TSBPointer|array of byte|string|NULL $OutBuffer, integer &$OutSize, TSBPointer|array of byte|string|NULL $Key, integer $KeySize)
    integer Encrypt(TStream $InStream, TStream $OutStream, integer $InCount)
    integer Encrypt(TStream $InStream, TStream $OutStream, TSBPointer|array of byte|string|NULL $Key, integer $KeySize, integer $InCount)

Parameters

  • InBuffer - Reference to the data to encrypt.
  • InStartIndex - Starting index of the data to be encrypted in the InBuffer.
  • InSize - Size of the input data in bytes.
  • OutBuffer - Reference to the buffer where encrypted data should be stored.
  • OutStartIndex - Starting index of the encrypted data in the OutBuffer.
  • OutSize - Size of the OutBuffer in bytes.
  • InStream - Stream to be encrypted.
  • OutStream - Resulting encrypted stream.
  • Key - Symmetric key for data encryption.
  • KeySize - Size of the Key.
  • InCount - Number of bytes to be read from InStream. If this parameter is 0 the data is read till the end of the stream.
    Default value is 0.

Return value

    0 if the encryption process was completed successfully, and an error code otherwise.

Possible values:


Description

    Use this method to encrypt blocks of data. Block of data is encrypted using each certificate from CertStorage and may be decrypted with any of that certificates. After the method is executed, OutSize parameter contains the number of bytes, written to the OutBuffer. If the buffer was too small, then the necessary size is put to OutSize.

See also:     CertStorage     Algorithm     ErrorInfo    

Discuss this help topic in SecureBlackbox Forum