-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
# RSA via OpenSSL libeay32 | ||
# RSA via OpenSSL libeay32 on Delphi / RAD Studio / Embarcadero | ||
Реализация шифрования/дешифрование строки алгоритмом RSA через библиотеку [openssl](https://www.openssl.org/) с указанием файлов секретного и публичного ключа в формате PEM. | ||
|
||
При ключе 1024 бит длина строки при **RSA_PKCS1_PADDING** = 117 байт, при **RSA_NO_PADDING** максимальная длина строки = 128 байт | ||
При увеличении битности ключа увеличивается длина строки для шифрования. | ||
|
||
Текущая версия исправлена и корректно работает после компиляции в EXE версииях и выше | ||
|
||
Для компиляции в **XE** необходимо поменять типы у входящих параметров | ||
|
||
####Delphi7: | ||
```delphi | ||
function LoadPrivateKey(KeyFile: string): pEVP_PKEY; | ||
function LoadPublicKey(KeyFile: string): pEVP_PKEY; | ||
``` | ||
####XE: | ||
```delphi | ||
function LoadPrivateKey(KeyFile: AnsiString): pEVP_PKEY; | ||
function LoadPublicKey(KeyFile: AnsiString): pEVP_PKEY; | ||
``` | ||
Implementation of encryption / decryption of a string using the RSA algorithm through the openssl library, specifying the secret and public key files in PEM format. | ||
|
||
With the 1024 bit key, the string length with **RSA_PKCS1_PADDING** = 117 bytes, with **RSA_NO_PADDING**, the maximum string length = 128 bytes. Increasing the key bit increases the encryption string length. | ||
The current version has been fixed and works correctly after compilation in XE versions and higher | ||
|
||
####Автор | ||
Иван Лодяной ([email protected]) |