mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
Currently including `zh_CN` and `es` which both have very high completion ratios. Others will be added once they reach a significant percentage too. These RST files will be used by godot-docs in place of its `classes` folder after we sync with https://github.com/godotengine/godot-docs/pull/5458. The update workflow is manual for now (example for `zh_CN`): - Build `godotengine/godot` in the branch we currently track (now `3.x`) - Run `godot --doctool -l zh_CN` - Run `cd doc && make rst LANGARG=zh_CN` - Copy `doc/_build/rst/*` to `classes/zh_CN/` here - Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
133 lines
7.0 KiB
ReStructuredText
133 lines
7.0 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the AESContext.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_AESContext:
|
|
|
|
AESContext
|
|
==========
|
|
|
|
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
|
|
|
Interfaz para las características de encriptación AES de bajo nivel.
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
Esta clase proporciona acceso a la encriptación/desencriptación AES de los datos en bruto. Tanto el modo AES-ECB como el AES-CBC están soportados.
|
|
|
|
::
|
|
|
|
extends Node
|
|
|
|
var aes = AESContext.new()
|
|
|
|
func _ready():
|
|
var clave = "Mi clave secreta!!!" # La clave debe ser de 16 o 32 bytes. (1 byte = 1 char) normalmdlkd
|
|
var datos = "Mi clave secreta" # El tamaño de datos debe ser multiplo de 16, ponga algún relleno para completar de ser necesario.
|
|
# Encriptar ECB
|
|
aes.start(AESContext.MODE_ECB_ENCRYPT, clave.to_utf8())
|
|
var encriptado = aes.update(datos.to_utf8())
|
|
aes.finish()
|
|
# Desencriptar ECB
|
|
aes.start(AESContext.MODE_ECB_DECRYPT, clave.to_utf8())
|
|
var desencriptado = aes.update(encriptado)
|
|
aes.finish()
|
|
# Comprobar ECB
|
|
assert(desencriptado == datos.to_utf8())
|
|
|
|
var iv = "Mi secreto iv!!!" # IV debe ser de tamaño 16 bytes.
|
|
# Encriptar CBC
|
|
aes.start(AESContext.MODE_CBC_ENCRYPT, clave.to_utf8(), iv.to_utf8())
|
|
encriptado = aes.update(datos.to_utf8())
|
|
aes.finish()
|
|
# Desencriptar CBC
|
|
aes.start(AESContext.MODE_CBC_DECRYPT, clave.to_utf8(), iv.to_utf8())
|
|
desencriptado = aes.update(encriptado)
|
|
aes.finish()
|
|
# Comprobar CBC
|
|
assert(desencriptado == datos.to_utf8())
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
+-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`finish<class_AESContext_method_finish>` **(** **)** |
|
|
+-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`get_iv_state<class_AESContext_method_get_iv_state>` **(** **)** |
|
|
+-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`start<class_AESContext_method_start>` **(** :ref:`Mode<enum_AESContext_Mode>` mode, :ref:`PoolByteArray<class_PoolByteArray>` key, :ref:`PoolByteArray<class_PoolByteArray>` iv=PoolByteArray( ) **)** |
|
|
+-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`update<class_AESContext_method_update>` **(** :ref:`PoolByteArray<class_PoolByteArray>` src **)** |
|
|
+-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Enumeraciones
|
|
--------------------------
|
|
|
|
.. _enum_AESContext_Mode:
|
|
|
|
.. _class_AESContext_constant_MODE_ECB_ENCRYPT:
|
|
|
|
.. _class_AESContext_constant_MODE_ECB_DECRYPT:
|
|
|
|
.. _class_AESContext_constant_MODE_CBC_ENCRYPT:
|
|
|
|
.. _class_AESContext_constant_MODE_CBC_DECRYPT:
|
|
|
|
.. _class_AESContext_constant_MODE_MAX:
|
|
|
|
enum **Mode**:
|
|
|
|
- **MODE_ECB_ENCRYPT** = **0** --- Modo encripción AES electronic codebook(ECB).
|
|
|
|
- **MODE_ECB_DECRYPT** = **1** --- Modo desencripción AES electronic codebook(ECB).
|
|
|
|
- **MODE_CBC_ENCRYPT** = **2** --- Modo encripción AES cipher blocker chaining (CBC).
|
|
|
|
- **MODE_CBC_DECRYPT** = **3** --- Modo desencripción AES cipher blocker chaining (CBC).
|
|
|
|
- **MODE_MAX** = **4** --- Valor máximo para el modo enum.
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_AESContext_method_finish:
|
|
|
|
- void **finish** **(** **)**
|
|
|
|
Cerrar este contexto AES para que pueda ser iniciado de nuevo. Ver :ref:`start<class_AESContext_method_start>`.
|
|
|
|
----
|
|
|
|
.. _class_AESContext_method_get_iv_state:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **get_iv_state** **(** **)**
|
|
|
|
Get the current IV state for this context (IV gets updated when calling :ref:`update<class_AESContext_method_update>`). You normally don't need this function.
|
|
|
|
\ **Note:** This function only makes sense when the context is started with :ref:`MODE_CBC_ENCRYPT<class_AESContext_constant_MODE_CBC_ENCRYPT>` or :ref:`MODE_CBC_DECRYPT<class_AESContext_constant_MODE_CBC_DECRYPT>`.
|
|
|
|
----
|
|
|
|
.. _class_AESContext_method_start:
|
|
|
|
- :ref:`Error<enum_@GlobalScope_Error>` **start** **(** :ref:`Mode<enum_AESContext_Mode>` mode, :ref:`PoolByteArray<class_PoolByteArray>` key, :ref:`PoolByteArray<class_PoolByteArray>` iv=PoolByteArray( ) **)**
|
|
|
|
Inicia el contexto AES en el ``mode``. Siempre debe proporcionarse un ``key`` de 16 o 32 bytes, mientras que un ``iv`` (vector de inicialización) de exactamente 16 bytes, sólo se necesitará cuando el ``mode`` es o bien :ref:`MODE_CBC_ENCRYPT<class_AESContext_constant_MODE_CBC_ENCRYPT>` o bien :ref:`MODE_CBC_DECRYPT<class_AESContext_constant_MODE_CBC_DECRYPT>`.
|
|
|
|
----
|
|
|
|
.. _class_AESContext_method_update:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **update** **(** :ref:`PoolByteArray<class_PoolByteArray>` src **)**
|
|
|
|
Run the desired operation for this AES context. Will return a :ref:`PoolByteArray<class_PoolByteArray>` containing the result of encrypting (or decrypting) the given ``src``. See :ref:`start<class_AESContext_method_start>` for mode of operation.
|
|
|
|
\ **Note:** The size of ``src`` must be a multiple of 16. Apply some padding if needed.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|