Delphi-OpenSSL-master
所属分类:Pascal/Delphi编程
开发工具:Delphi
文件大小:24KB
下载次数:12
上传日期:2018-01-03 19:08:23
上 传 者:
ANATOLY
说明: hi this is Delphi SSL component source code for use this code and create secure communication between client and server application.
文件列表:
.hgignore (139, 2016-09-15)
Samples (0, 2016-09-15)
Samples\SSLDemo (0, 2016-09-15)
Samples\SSLDemo\SSLDemo.EncFrame.dfm (2047, 2016-09-15)
Samples\SSLDemo\SSLDemo.EncFrame.pas (2153, 2016-09-15)
Samples\SSLDemo\SSLDemo.MainForm.dfm (849, 2016-09-15)
Samples\SSLDemo\SSLDemo.MainForm.pas (2833, 2016-09-15)
Samples\SSLDemo\SSLDemo.MainFrame.dfm (4256, 2016-09-15)
Samples\SSLDemo\SSLDemo.MainFrame.pas (4935, 2016-09-15)
Samples\SSLDemo\SSLDemo.RSABufferFrame.dfm (3706, 2016-09-15)
Samples\SSLDemo\SSLDemo.RSABufferFrame.pas (4678, 2016-09-15)
Samples\SSLDemo\SSLDemo.dpr (2205, 2016-09-15)
Samples\SSLDemo\SSLDemo.dproj (24760, 2016-09-15)
Samples\SSLDemo\SSLDemo.res (1968, 2016-09-15)
Source (0, 2016-09-15)
Source\OpenSSL.Core.pas (5741, 2016-09-15)
Source\OpenSSL.EncUtils.pas (14123, 2016-09-15)
Source\OpenSSL.RSAUtils.pas (12791, 2016-09-15)
Source\OpenSSL.libeay32.pas (5339, 2016-09-15)
TestData (0, 2016-09-15)
TestData\create_cert.bat (170, 2016-09-15)
TestData\create_cert_pwd.bat (179, 2016-09-15)
# Delphi OpenSSL Library
[Delphi](http://www.embarcadero.com/products/delphi) implementation of [OpenSSL](https://openssl.org/).
## Features
- Encrypt/Decrypt using RSA algorithm
- Symmetric cipher routines (for now only AES256)
- Base*** encoding e decoding
- Basic PAM support
## Usage
### Encrypt with the public key inside X509 certificate
*Command line:*
OpenSSL rsautl -encrypt -certin -inkey publiccert.cer -in test.txt -out test.txt.cry
*Source code:*
```
#!delphi
var
RSAUtil :TRSAUtil;
Cerificate :TX509Cerificate;
begin
RSAUtil := TRSAUtil.Create;
try
Cerificate := TX509Cerificate.Create;
try
Cerificate.LoadFromFile('publiccert.cer');
RSAUtil.PublicKey.LoadFromCertificate(Cerificate);
RSAUtil.PublicEncrypt('test.txt', 'test.txt.cry');
finally
Cerificate.Free;
end;
finally
RSAUtil.Free;
end;
end;
```
### Encrypt with the public key in PEM format
*Command line:*
OpenSSL rsautl -encrypt -pubin -inkey publickey.pem -in test.txt -out test.txt.cry
*Source code:*
```
#!delphi
var
RSAUtil :TRSAUtil;
begin
RSAUtil := TRSAUtil.Create;
try
RSAUtil.PublicKey.LoadFromFile('publickey.pem');
RSAUtil.PublicEncrypt('test.txt', 'test.txt.cry');
finally
RSAUtil.Free;
end;
end;
```
### Decrypt with the private key in PEM format
*Command line:*
OpenSSL rsautl -decrypt -inkey privatekey.pem -in test.txt.cry -out test.txt
*Source code:*
```
#!delphi
var
RSAUtil :TRSAUtil;
begin
RSAUtil := TRSAUtil.Create;
try
RSAUtil.PrivateKey.OnNeedPassphrase := PassphraseReader;
RSAUtil.PrivateKey.LoadFromFile('privatekey.pem');
RSAUtil.PrivateDecrypt('test.txt.cry', 'test.txt');
finally
RSAUtil.Free;
end;
end;
```
## Todo
- Symmetric cryptography (partially done)
- compute hash functions
- Sign e verify
- Generation of pseudo-random bit strings
- RSA data management
- Data managing for X509
- Manage information according to the PKCS #12 standard
## Prerequisite
OpenSSL library must be in your system path
## Installation
- Add the source path "Source" to your Delphi project path
- Run the demo and follow the tutorial
近期下载者:
相关文件:
收藏者: