AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de cifrado/compresión
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Descifra un buffer con un algoritmo de clave privada/pública según el cifrado RSA. Los datos se cifraron previamente con la función EncryptAsymmetric.
Ejemplo
// Encrypting a character string
// ---------------------------------------
bufToEncrypt is Buffer = "Message to encrypt"
bufEncryptedMessage is Buffer
sPublicKeyFile is string = fExeDir() + "\PublicKey.pem"
sPublicKeyPassword is string = "xxx"
 
bufEncryptedMessage = EncryptAsymmetric(bufToEncrypt, sPublicKeyFile, ...
sPublicKeyPassword, cryptPaddingPKCS1)
 
// Decryption  
// -------------
bufEncryptedMessage is Buffer
bufDecryptedMessage is Buffer
sPrivateKeyFile is string = fExeDir() + "\PrivateKey.pem"
sPrivateKeyPassword is string = "xxx"
 
bufDecryptedMessage = DecryptAsymmetric(bufEncryptedMessage, sPrivateKeyFile, ...
sPrivateKeyPassword, cryptPaddingPKCS1)
bufToEncrypt is Buffer = StringToUTF8("สวัสดี Test")
bufPrivateKey is Buffer
bufPublicKey is Buffer
(bufPrivateKey, bufPublicKey) = EncryptGenerateRSAKey(1024)
// Encryption
bufEncrypted is Buffer = EncryptAsymmetric(bufToEncrypt, bufPublicKey)
bufSign is Buffer = CertificateSignString(bufEncrypted, bufPrivateKey, "", ...
certSignatureOnly + certSHA256)
// Decryption
IF CertificateCheckString(bufEncrypted, bufSign, bufPublicKey, "", "", ...
certSignatureOnly + certSHA256) THEN
bufReadable is Buffer = DecryptAsymmetric(bufEncrypted, bufPrivateKey)
Trace("Authentic message")
Trace(UTF8ToString(bufReadable))
ELSE
Trace("Unauthenticated message")
END
Sintaxis
<Result> = DecryptAsymmetric(<Content to decrypt> , <Private key file> [, <Password> [, <Padding>]])
<Result>: Buffer
Datos descifrados.
<Content to decrypt>: Buffer
Buffer a descifrar.
<Private key file>: Cadena de caracteres o Buffer
  • Nombre y ruta del archivo que corresponde a la clave privada RSA que se utilizará para descifrar los datos. Los formatos de clave pem, y p12 están soportados.
  • Buffer que contiene la clave privada RSA que se utilizará para descifrar los datos.
<Password>: Cadena de caracteres opcional
Contraseña del archivo de claves (si es necesario).
<Padding>: Constante opcional de tipo Integer
Modo de relleno (utilizado durante el cifrado) para que los datos cifrados sean compatibles con el tamaño requerido por los algoritmos de cifrado por bloques:
cryptPaddingOAEPRelleno según el algoritmo OAEP (Optimal Asymmetric Encryption Padding).
cryptPaddingPKCS1
(Valor predeterminado)
Relleno según el algoritmo PKCS 1 (Public Key Cryptographic Standards).
Componente: wd290com.dll
Versión mínima requerida
  • Versión 24
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/11/2023

Señalar un error o enviar una sugerencia | Ayuda local