相关疑难解决方法(0)

Delphi和PHP中的安全密钥对加密解决方案?

我的应用程序通过Internet发送加密文件,我需要能够执行以下操作:

  1. (客户端Delphi 2010):使用我的应用程序附带的公钥加密文件并将其上传到服务器
  2. (服务器端PHP):使用存储在服务器上的私钥解密上传的文件
  3. (处理上传的文件...)

听起来很简单,但我找不到任何可靠的代码/组件,我找到了这些组件:

  1. DCPcrypt.这就是我现在正在开发中使用但似乎不支持基于密钥对的加密(RSA?)

  2. GnuPgp(GPL)所以我不能在我的商业应用程序上使用它.

  3. TurboPower LockBox 3:支持密钥对加密,但非常神秘(没有文档AFAIK),似乎不支持文件加密.

我的问题是:是否存在安全/可靠的加密组件:

  1. 实现我上面描述的内容(即密钥对加密)
  2. 可以使用PHP解密
  3. 适用于大型文件/流
  4. (在这里做梦!)有一个简单的delphi/php演示,展示了如何做到这一点?:)
  5. FOSS解决方案只是请,我已经超出预算:)

delphi security encryption rsa lockbox-3

5
推荐指数
1
解决办法
3169
查看次数

TPLockBox3 和 PHP - Delphi 中的 AES 加密,PHP 中的解密

我在使用 lockbox3 和 PHP mcrypt 时遇到了麻烦。我无法将 IV 传递给 PHP。德尔福代码

var
  Codec: TCodec;
  CL: TCryptographicLibrary;
  PlainStream: TStringStream;
  CipherStream: TMemoryStream;
begin
  PlainStream := TStringStream.Create(Edit1.Text);
  CipherStream := TMemoryStream.Create;

  CL := TCryptographicLibrary.Create(nil);
  Codec := TCodec.Create(nil);
  Codec.CryptoLibrary := CL;
  Codec.ChainModeId := uTPLb_Constants.CBC_ProgId;
  Codec.StreamCipherId := uTPLb_Constants.BlockCipher_ProgId;
  Codec.BlockCipherId := Format(uTPLb_Constants.AES_ProgId, [256]);
  Codec.Password := Edit3.Text;

  Codec.EncryptStream(PlainStream, CipherStream);
  Codec.Burn;

  Memo1.Text := Stream_to_Base64(CipherStream);
  Memo2.Clear;
  Memo2.Lines.Add(Format('Size: %d bytes', [CipherStream.Size]));
  Memo2.Lines.Add(Format('Original size: %d bytes', [PlainStream.Size]));

  Codec.Free;
  CL.Free;
  CipherStream.Free;
  PlainStream.Free;
Run Code Online (Sandbox Code Playgroud)

PHP 代码

  $ciphertext = base64_decode("zA/eeF+WFVMDsZ7+iA==");
  $iv = substr($ciphertext, 0, …
Run Code Online (Sandbox Code Playgroud)

php delphi cryptography aes lockbox-3

3
推荐指数
1
解决办法
3241
查看次数

标签 统计

delphi ×2

lockbox-3 ×2

aes ×1

cryptography ×1

encryption ×1

php ×1

rsa ×1

security ×1