CL_ABAP_HMAC - Message Authentication Code (MAC) of a message

rdisp/max_wprun_time - Maximum work process run time   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Functionality

This class allows the generation of a message authentication code, also known as a MAC.

A MAC procedure that operates of the basis of one-way hash functions is known as an HMAC. The distinguishingfeatures of these functions are that they are not reversible and that no collisions can be calculated.This means that it must not be possible to recreate the original text for a cryptotext (irreversible).It must also not be possible to calculate a text that produces the same cryptotext as the original text (collision-free).

Relationships

Different hash algorithms, such as SHA1 or SHA256, are installed depending on the ABAP kernel.

The HMAC procedure is different from the classic HASH procedure in that it is based on a "secret" (symmetric) key. This means that an HMAC can only be checked by its generator.

Example

DATA: lo_hmac TYPE Ref To cl_abap_hmac.

DATA: lf_hmac_string TYPE string.

lo_hmac = cl_abap_hmac=>get_instance( 'sha1' 'secret' ).

" update HMAC with input

lo_hmac->update( if_data = '010203' ).

" finalise hmac

lo_digest->final( ).

" String

lf_hmac_string   = lo_hmac->to_string( ).

" Base64 representation

lf_hmac_string  = lo_hmac->to_base64( ).

Notes

The calculation of a hash value is necessary, for example, to make long texts in a database table indexable.The length of a hash value is always constant; for example, 20 bytes for SHA1. Generating a hash from a string/long text in a table means that it can be indexed and can therefore be found again more quickly.

Further information

http://www.ietf.org/rfc/rfc2104.txt



General Material Data   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.


Length: 1818 Date: 20120526 Time: 081851     triton ( 84 ms )