AES192decrypt and AES192encrypt (String functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{Template:String:AES192decrypt and AES192encrypt subtitle}} This page is under construction. ==Syntax== {{Template:String:AES192decrypt syntax}} {{Template:String:AES19...")
 
mNo edit summary
Line 1: Line 1:
{{Template:String:AES192decrypt and AES192encrypt subtitle}}
{{Template:String:AES192decrypt and AES192encrypt subtitle}}


This page is [[under construction]].
<var>AES192decrypt</var> and <var>AES192encrypt</var> are synonyms for the [[String class]] function that applies the AES (Advanced Encryption Standard) using a 192-bit symmetric key to decrypt or encrypt each 128-bit block of input text. For more details about how the algorithm works, see [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard Advanced Encryption Standard].
 
The length of the returned string is the same as that of the object string.
 
AES is a two-way cipher, so encrypting a string with a key and then decrypting the result of that encryption with the same key produces the original string. That is, the following assertion should <b><i>always</i></b> hold:
<p class="code">[[Assert statement|assert]] %string:aes192encrypt(%key):aes192decrypt(%key) eq %string
</p>
You can use <var>AES192decrypt</var> to "document" that you are decrypting, and
use <var>AES192encrypt</var> to "document" that you are enrypting. You can use <var>AES192decrypt</var> and <var>AES192encrypt</var> interchangeably on the rest of this page.


==Syntax==
==Syntax==
Line 9: Line 17:
===Syntax terms===
===Syntax terms===
<table>
<table>
<tr><th>%outString</th><td>string</td></tr>
<tr><th>%outString</th>
<td>A string variable to receive the encrypted or decrypted method object <var class="term">string</var>. Its length is the same as <var class="term">string</var>.</td></tr>


<tr><th>string</th>
<tr><th>string</th>
<td>string</td></tr>
<td>The string to which the method is applied. <var class="term">string</var> must be a multiple of sixteen bytes in length; its  maximum is 32768 bytes. It may be null.</td></tr>


<tr><th>key</th>
<tr><th>key</th>
<td>string, length 24</td></tr>
<td>A 24-byte (only) string variable whose value is used to encrypt or decrypt the method object, <var class="term">string</var>.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<li>You are <b><i>not</i></b> prevented from creating confusion by encrypting with <var>AES192decrypt</var> and decrypting with <var>AES192encrypt</var>. </li>
<li>The <var>AES192decrypt</var> and <var>AES192encrypt</var> functions are available as of <var class="product">Model&nbsp;204</var> 7.6. </li>
</ul>


==Examples==
==Examples==
In the following example, the output string from the <var>AES192encrypt</var> method is converted to hex using the <var>[[StringToHex (String function)|StringToHex]]</var> function to reveal its non-displayable characters, then decrypted to return the original input string:
<p class="code">b                   
%ls is longstring   
%string is longstring
%key is string len 24
%string = 'onetwothreefour0onetwothreefour0'
%key = '123456781616161624242424'
%ls = %string:aes192encrypt(%key)
[[PrintText statement|printText]] {~} is {%ls:stringTohex}
printText {~} is: {%ls:aes192decrypt(%key)}
end
</p>
The result is:
<p class="output">%ls:stringTohex is: 27441031038470A77F92E78E1329166427441031038470A77F92E78E13291664
%ls:aes192decrypt(%key) is: onetwothreefour0onetwothreefour0
</p>


==See also==
==See also==
<ul>
<li><var>[[AES128decrypt and AES128encrypt (String functions)]]</var> </li>
<li><var>[[AES256decrypt and AES256encrypt (String functions)]]</var> </li>
<li><var>[[AES128CBCdecrypt and AES128CBCencrypt (String functions)]]</var> </li>
<li><var>[[AES192CBCdecrypt and AES192CBCencrypt (String functions)]]</var> </li>
<li><var>[[AES256CBCdecrypt and AES256CBCencrypt (String functions)]]</var> </li>
</ul>
{{Template:String:AES192decrypt and AES192encrypt footer}}
{{Template:String:AES192decrypt and AES192encrypt footer}}

Revision as of 22:40, 11 March 2016

AES192 encryption or decryption (String class)

[Introduced in Model 204 7.6]


AES192decrypt and AES192encrypt are synonyms for the String class function that applies the AES (Advanced Encryption Standard) using a 192-bit symmetric key to decrypt or encrypt each 128-bit block of input text. For more details about how the algorithm works, see Advanced Encryption Standard.

The length of the returned string is the same as that of the object string.

AES is a two-way cipher, so encrypting a string with a key and then decrypting the result of that encryption with the same key produces the original string. That is, the following assertion should always hold:

assert %string:aes192encrypt(%key):aes192decrypt(%key) eq %string

You can use AES192decrypt to "document" that you are decrypting, and use AES192encrypt to "document" that you are enrypting. You can use AES192decrypt and AES192encrypt interchangeably on the rest of this page.

Syntax

%outString = string:AES192decrypt( key) Throws UnsupportedCrypto, InvalidCryptoKey, InvalidCryptoData

%outString = string:AES192encrypt( key) Throws UnsupportedCrypto, InvalidCryptoKey, InvalidCryptoData

Syntax terms

%outString A string variable to receive the encrypted or decrypted method object string. Its length is the same as string.
string The string to which the method is applied. string must be a multiple of sixteen bytes in length; its maximum is 32768 bytes. It may be null.
key A 24-byte (only) string variable whose value is used to encrypt or decrypt the method object, string.

Usage notes

  • You are not prevented from creating confusion by encrypting with AES192decrypt and decrypting with AES192encrypt.
  • The AES192decrypt and AES192encrypt functions are available as of Model 204 7.6.

Examples

In the following example, the output string from the AES192encrypt method is converted to hex using the StringToHex function to reveal its non-displayable characters, then decrypted to return the original input string:

b %ls is longstring %string is longstring %key is string len 24 %string = 'onetwothreefour0onetwothreefour0' %key = '123456781616161624242424' %ls = %string:aes192encrypt(%key) printText {~} is {%ls:stringTohex} printText {~} is: {%ls:aes192decrypt(%key)} end

The result is:

%ls:stringTohex is: 27441031038470A77F92E78E1329166427441031038470A77F92E78E13291664 %ls:aes192decrypt(%key) is: onetwothreefour0onetwothreefour0

See also