Discuss this help topic in SecureBlackbox Forum

TElSymmetricCrypto.Encrypt

TElSymmetricCrypto     See also     


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


Encrypts the data.

Declaration

[C#]
    void Encrypt(System.IO.Stream InStream, System.IO.Stream OutStream);
    void Encrypt(byte[] InBuffer, int InIndex, int InSize, ref byte[] OutBuffer, int OutIndex, ref int OutSize);
    static byte[] Encrypt(int AlgID, byte[] Key, byte[] IV, TSBSymmetricCryptoMode Mode, byte[] Buffer);
    static byte[] Encrypt(int AlgID, byte[] Key, byte[] IV, TSBSymmetricCryptoMode Mode, byte[] Buffer, int Offset, int Count);

[VB.NET]
    Sub Encrypt(ByVal InStream As System.IO.Stream, ByVal OutStream As System.IO.Stream)
    Sub Encrypt(ByVal InBuffer As Byte(), ByVal InIndex As Integer, ByVal InSize As Integer, ByRef OutBuffer As Byte(), ByVal OutIndex As Integer, ByRef OutSize As Integer)
    Shared Function Encrypt(ByVal AlgID As Integer, ByVal Key As Byte(), ByVal IV As Byte(), ByVal Mode As TSBSymmetricCryptoMode, ByVal Buffer As Byte()) As Byte()
    Shared Function Encrypt(ByVal AlgID As Integer, ByVal Key As Byte(), ByVal IV As Byte(), ByVal Mode As TSBSymmetricCryptoMode, ByVal Buffer As Byte(), ByVal Offset As Integer, ByVal Count As Integer) As Byte()

[Pascal]
    procedure Encrypt(InBuffer : pointer; InSize : integer; OutBuffer : pointer; var OutSize : integer); overload;
    procedure Encrypt(InStream, OutStream : TStream); overload;
    class function Encrypt(AlgID : integer; const Key, IV : ByteArray; Mode : TSBSymmetricCryptoMode; Buffer : Pointer; Size : integer) : ByteArray; overload;

[C++]
    void Encrypt(void * InBuffer, int32_t InSize, void * OutBuffer, int32_t &OutSize);
    void Encrypt(TStream &InStream, TStream &OutStream);
    void Encrypt(TStream *InStream, TStream *OutStream);
    static void Encrypt(int32_t AlgID, const std::vector<uint8_t> &Key, const std::vector<uint8_t> &IV, TSBSymmetricCryptoMode Mode, void * Buffer, int32_t Size, std::vector<uint8_t> &OutResult);

[PHP]
    void Encrypt(TSBPointer|array of byte|string|NULL $InBuffer, integer $InSize, TSBPointer|array of byte|string|NULL $OutBuffer, integer &$OutSize)
    void Encrypt(TStream $InStream, TStream $OutStream)
    string Encrypt(integer $AlgID, array of byte|string|NULL $Key, array of byte|string|NULL $IV, integer $Mode, TSBPointer|array of byte|string|NULL $Buffer, integer $Size)

[Java]
    static byte[] encrypt(TElSymmetricCrypto> this, int AlgID, byte[] Key, byte[] IV, TSBSymmetricCryptoMode Mode, byte[] Buffer, int Offset, int Count);
    static byte[] encrypt(TElSymmetricCrypto> this, int AlgID, byte[] Key, byte[] IV, TSBSymmetricCryptoMode Mode, byte[] Buffer);
    void encrypt(InputStream InStream, OutputStream OutStream);
    int encrypt(byte[] InBuffer, int InIndex, int InSize, byte[][] OutBuffer, int OutIndex, int OutSize);
    void encrypt(TElStream InStream, TElStream OutStream);

Parameters

  • AlgID - specifies the encryption algorithm.
  • Buffer - buffer with data to be encrypted.
  • Size - the size of the data block (in Buffer) to be encrypted.
  • Offset - the offset of the data to be encrypted in Buffer.
  • Count - the number of bytes to be read from Buffer.
  • IV - specifies the Initial Vector.
  • InBuffer - buffer with data to be encrypted.
  • InIndex - the offset of the data to be encrypted in InBuffer.
  • InSize - the size of the data block (in InBuffer) to be encrypted.
  • InStream - stream with data to be encrypted.
  • InCount - number of bytes to be read from InStream.
  • Key - the secret key.
  • Mode - specifies the encryption mode.
  • OutBuffer - buffer where the encrypted data should be stored.
  • OutIndex - the fffset in the OutBuffer, starting from which the data is written.
  • OutSize - the amount of free space in OutBuffer, in bytes.
  • OutStream - stream where the decrypted data will be written.

Algorithm identifier values:

Mode values:

Return value

    Returns the encrypted data.

Description

    Use this method to encrypt the data when all data to be encrypted is at hand. This method is a shorthand for InitializeEncryption / EncryptUdpdate / FinalizeEncryption sequence of calls. Remember to set Padding mode when using block mode of block ciphers.

See also:     InitializeEncryption     FinalizeEncryption     EncryptUpdate     Decrypt     Padding    

Discuss this help topic in SecureBlackbox Forum