Official Content

Note: This is part of GeneXus Cryptography Module.

CMAC

Calculate

Calculates a CMAC with the given password, macSize, and symmetric block encryption algorithm.

Cmac.Calculate(plainText, key, algorithm, macSize)
  • Input plainText: VarChar(256)
  • Input key: VarChar(256) hexadecimal
  • Input algorithm: SymmetricBlockAlgorithm Domain value
  • Input macSize: Numeric (9.0)
  • Returns: VarChar(256)
Example:

&plainText="Lorem ipsum dolor sit amet"
&key="64887e525dce27351f5cb5ce85615e52"
&mac=&Cmac.Calculate(&plainText, &password, SymmetricBlockAlgorithm.AES, 128)

Verify

Validates a CMAC for the given parameters

Cmac.Verify(plainText, key, mac, algorithm, macSize)
  • Input plainText: VarChar(256)
  • Input key: VarChar(256) hexadecimal
  • Input mac: VarChar(256) hexadecimal
  • Input algorithm: SymmetricBlockAlgorithm Domain value
  • Input macSize: Numeric (9.0)
  • Returns boolean true if the mac is valid
Example:

&plainText="Lorem ipsum dolor sit amet"
&key="64887e525dce27351f5cb5ce85615e52"
&mac =""
&mac=&Cmac.Calculate(&plainText, &password, &mac, SymmetricBlockAlgorithm.AES, 128)

 




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant