-
-
[求助]RSA of DELPHI
-
发表于: 2010-5-25 20:29 5716
-
program t; {$APPTYPE CONSOLE} uses Windows,SysUtils; type BN_STRUCT = record d: Pointer; top, dmax, neg, flags: integer; end; BIGNUM = ^BN_STRUCT; PBIGNUM = ^BIGNUM; RSA_STRUCT = record pad, version: integer; meth: pointer; n, e, d, p, q, dmp1, dmpq1, iqmp: BIGNUM; end; RSA = ^RSA_STRUCT ; function BN_new: BIGNUM; cdecl; external 'libeay32.dll'; function RSA_new: RSA; cdecl; external 'libeay32.dll'; function BN_bin2bn(s: PChar; len: integer; ret: BIGNUM): BIGNUM; cdecl;external 'libeay32.dll'; function RSA_public_encrypt(Len: integer; Source, Dest: Pointer;rsa: RSA; padding: integer): integer; cdecl; external 'libeay32.dll'; const SEC_MODULUS_SIZE = 64; SEC_EXPONENT_SIZE = 4; smd5 : array[0..SEC_MODULUS_SIZE -1 ] of Byte = ( $01, $01, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $00, $81, $2A, $14, $9C, $B7, $64, $78, $F2, $0B, $96, $11, $AC, $3E, $DC, $70, $2F); ekey :array [0..3] of Byte = ($01, $02 ,$03,$04); nkey :array[0..SEC_MODULUS_SIZE -1 ] of Byte=( $59, $B0, $19, $37, $F7, $4E, $AC, $96, $4D, $61, $DC, $FC, $64, $AD, $55, $AE, $7C, $CC, $27, $A7, $32, $CB, $BD, $35, $A2, $9F, $CE, $B9, $80, $48, $8B, $F1, $49, $E1, $8B, $6F, $B1, $F9, $02, $E1, $59, $4B, $E4, $B0, $20, $F8, $18, $DA, $B7, $3D, $83, $16, $7D, $3F, $D1, $1B, $C6, $45, $98, $EE, $64, $F1, $4E, $CA); var e,n:BIGNUM; s_key:RSA ; code:array [0..SEC_MODULUS_SIZE -1] of Byte; begin n := BN_new; BN_bin2bn(@nkey,SEC_MODULUS_SIZE, n); e := BN_new; BN_bin2bn(@ekey, SEC_EXPONENT_SIZE, e); s_key := RSA_new; s_key.n := n; s_key.e := e; RSA_public_encrypt(SEC_MODULUS_SIZE,@smd5,@code,s_key, 3); end.
在OD里查看 code全为0 也就是没有成功加密。怎么回事。我很迷茫.
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
他的文章
- [求助]RSA of DELPHI 5717
- [求助]请教一个数的转换 4914
- [求助]这个结构怎么转换为DELPHI 3903
- [己解决]请教个关于DLL调试问题 4542
- [讨论]关于RSA TOOL2 与 BIGINT 4822
看原图
赞赏
雪币:
留言: