cookie CmCryptSim

Description

CmCryptSim encrypts or decrypts data with direct or indirect encryption (see Encryption Modes) by using the Firm Security Box (FSB) entry of the desired Firm Code.

tmr_02

Triple Mode Redundancy-related information (TMR)

  • C, C++
  • C#
  • Python

Syntax

int CMAPIENTRY CmCryptSim(HCMSysEntry hcmse, CMULONG flCtrl, CMCRYPTSIM *pcmCryptSim, void* pvDest, CMUINT cbDest)

Parameter

hcmse contains a handle opened by CmAccess / CmAccess2. Access Mode must be Entry Access to the FSB entry of the desired Firm Code. If the Firm Code is an evaluation Firm Code, the access can be SubSystem Access. A matching entry in the CmLicensor/CmFirm.wbc file has to exist in both cases.

flCtrl contains the encryption or decryption command. Following commands are supported:

nav_open CM_CRYPT_DIRECT_ENC executes the direct symmetric encryption via a CmContainer entry. The length of bytes to encrypt must be exactly 16 bytes (for CM_CRYPT_AES) or between 0 and 32 bytes (for CM_CRYPT_ECIES and CM_CRYPT_ECIES_STD) - see structure hmtoggle_plus1 CMBASECRYPT.

nav_open CM_CRYPT_DIRECT_DEC executes the direct symmetric decryption via a CmContainer entry. The length of bytes to decrypt must be exactly 16 bytes (for CM_CRYPT_AES) or between 0 and 32 bytes (for CM_CRYPT_ECIES and CM_CRYPT_ECIES_STD) - see CMBASECRYPT.

nav_open CM_CRYPT_AES_ENC_CBC executes the indirect encryption using the AES block cipher algorithm with CBC. The length of the sequence to encrypt must be at least 16 bytes.

nav_open CM_CRYPT_AES_DEC_CBC executes the indirect decryption using the AES block cipher algorithm with CBC. The length of the sequence to decrypt must be at least 16 bytes.

information_weiss_klein26

Wibu-Systems recommends this mode since CBC is the most commonly used mode of operation.

Although CodeMeter supports also other older cryptographic modes. However, their use is not recommended.

For more information see the technical guideline TR-02102-1 "Cryptographic Mechanisms: Recommendations and Key Lengths" (courtesy translation) edited by the German Federal Office for Information Security, BSI (Bundesamt für Sicherheit in der Informationstechnik) (BSI).

pcmCryptSim sets some needed data for the en-/decryption process (see hmtoggle_plus1 CMCRYPTSIM).

pvDest contains the data to en-/decrypt.

cbDest contains the number of bytes to en-/decrypt stored in pvDest.  

Return

This function returns the number of en-/decrypted bytes. If an error occurred, 0 will be returned.

Notes

The key source in CMCRYPTSIM::mcmcrypt::mflCtrl can only be the Firm Key. Other key sources like Hidden Data or Secret Data cannot be simulated by a FSB.

This function is only for Licensor site because a FSB is required.

Syntax

This method is overloaded, i.e. the same method name is used with different type of parameters or different set of parameters.

information_weiss_klein26

Wibu-Systems recommends this mode since CBC is the most commonly used mode of operation.

Although CodeMeter supports also other older cryptographic modes. However, their use is not recommended.

For more information see the technical guideline TR-02102-1 "Cryptographic Mechanisms: Recommendations and Key Lengths" (courtesy translation) edited by the German Federal Office for Information Security, BSI (Bundesamt für Sicherheit in der Informationstechnik) (BSI).

Method 1:

public bool CmCryptSim(HCMSysEntry hcmse, CmCryptOption Ctrl, CmCryptSim CryptSim, byte[] Dest)

This method overload encrypts and decrypts data in bytes as specified in the Dest field of the method.

Method 2:

public bool CmCryptSim(HCMSysEntry hcmse, CmCryptOption Ctrl, CmCryptSim CryptSim, byte[] Dest, int StartIndex, uint DestLen)

This method overload encrypts and decrypts data in bytes with a StartIndex and DestLen as the total size of the destination buffer.

Parameter

hcmse contains a handle opened by CmAccess / CmAccess2. Access Mode must be Entry Access to the FSB entry of the desired Firm Code. If the Firm Code is an evaluation Firm Code, the access can be SubSystem Access. A matching entry in the CmLicensor/CmFirm.wbc file has to exist in both cases.

CmCryptOption contains the encryption or decryption command. Following commands are supported:

nav_open DirectEncryption executes the direct symmetric encryption via a CmContainer entry. The length of bytes to encrypt must be exactly 16 bytes (for Aes) or between 0 and 32 bytes (for Ecies and EciesStd) - see class hmtoggle_plus1 CmBaseCrypt.

nav_open DirectDecryption executes the direct symmetric decryption via a CmContainer entry. The length of bytes to decrypt must be exactly 16 bytes (for Aes) or between 0 and 32 bytes (for Ecies and EciesStd) - see class CmBaseCrypt.

nav_open AesEncryptCbc executes the indirect encryption using the AES block cipher algorithm with CBC. The length of the sequence to encrypt must be at least 16 bytes.

nav_open AesDecryptCbc executes the indirect decryption using the AES block cipher algorithm with CBC. The length of the sequence to decrypt must be at least 16 bytes.

information_weiss_klein26

Wibu-Systems recommends this mode since CBC is the most commonly used mode of operation.

Although CodeMeter supports also other older cryptographic modes. However, their use is not recommended.

For more information see the technical guideline TR-02102-1 "Cryptographic Mechanisms: Recommendations and Key Lengths" (courtesy translation) edited by the German Federal Office for Information Security, BSI (Bundesamt für Sicherheit in der Informationstechnik) (BSI).

CryptSim sets some needed data for the en-/decryption process (see class hmtoggle_plus1 CmCryptSim).

Dest contains the data to en-/decrypt.

Return

This function returns true. If an error occurred, false will be returned.

Notes

The key source in CmCryptSim:Ctrl can only be the Firm Key. Other key sources like Hidden Data or Secret Data cannot be simulated by a FSB.

This function is only for Licensor site because a FSB is required.

 

Syntax

import cmapi
 
handle.CmCryptSim(flCtrl: int, pcmCryptSim: cmapi.CMCRYPTSIM,
 pvDest: bytes) -> bytes
throws CodeMeterApiFailedException()

Parameter

handle is the handle opened by CmAccess2. Access Mode must be Entry Access to the FSB entry of the desired Firm Code. If the Firm Code is an evaluation Firm Code, the access can be SubSystem Access. A matching entry in the CmLicensor/CmFirm.wbc file has to exist in both cases.

flCtrl contains the encryption or decryption command. Following commands are supported:

nav_open cmapi.CM_CRYPT_DIRECT_ENC executes the direct symmetric encryption via a CmContainer entry. The length of bytes to encrypt must be exactly 16 bytes (for CM_CRYPT_AES) or between 0 and 32 bytes (for cmapi.CM_CRYPT_ECIES and cmapi.CM_CRYPT_ECIES_STD) - see structure hmtoggle_plus1 cmapi.CMBASECRYPT.

nav_open cmapi.CM_CRYPT_DIRECT_DEC executes the direct symmetric decryption via a CmContainer entry. The length of bytes to decrypt must be exactly 16 bytes (for cmapi.CM_CRYPT_AES) or between 0 and 32 bytes (for cmapi.CM_CRYPT_ECIES and cmapi.CM_CRYPT_ECIES_STD) - see cmapi.CMBASECRYPT.

nav_open cmapi.CM_CRYPT_AES_ENC_CBC executes the indirect encryption using the AES block cipher algorithm with CBC. The length of the sequence to encrypt must be at least 16 bytes.

nav_open cmapi.CM_CRYPT_AES_DEC_CBC executes the indirect decryption using the AES block cipher algorithm with CBC. The length of the sequence to decrypt must be at least 16 bytes.

information_weiss_klein26

Wibu-Systems recommends this mode since CBC is the most commonly used mode of operation.

Although CodeMeter supports also other older cryptographic modes. However, their use is not recommended.

For more information see the technical guideline TR-02102-1 "Cryptographic Mechanisms: Recommendations and Key Lengths" (courtesy translation) edited by the German Federal Office for Information Security, BSI (Bundesamt für Sicherheit in der Informationstechnik) (BSI).

pcmCryptSim sets some needed data for the en-/decryption process (see hmtoggle_plus1 cmapi.CMCRYPTSIM).

pvDest contains the data to en-/decrypt.

Return

This function returns the number of en-/decrypted bytes. If an error occurred, an exception is thrown.

Notes

The key source in CMAPI.CMCRYPTSIM::mcmcrypt::mflCtrl can only be the Firm Key. Other key sources like Hidden Data or Secret Data cannot be simulated by a FSB.

This function is only for Licensor site because a FSB is required.