Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-04

Public key algo pascal only

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

José Mejuto

Hello,

Is there any public/private key algorithm, pascal only, implemented in the distribution of fpc ? Degree of security is not important, also a 3rd party unit which does not depends on a DLL or depends on another software to generate key pairs, or other tasks, would be valid too.

Thank you.

Reply by email

Michael Van Canneyt
to José Mejuto
José Mejuto wrote 6 lines
Hello, Is there any public/private key algorithm, pascal only, implemented in the distribution of fpc ? Degree of security is not important, also a 3rd party unit which does not depends on a DLL or depends on another software to generate key pairs, or other tasks, would be valid too.

Not to my knowledge. All solutions use gnutls or openssl.

I know of TMS Crypto, but it also uses .obj files that were generated using C, as far as I know.

Maybe DCrypt has the necessary routines, Graeme Geldenhuys maintains a version that works with FPC.

Michael.

Reply by email

José Mejuto
to Michael Van Canneyt
Michael Van Canneyt wrote
Maybe DCrypt has the necessary routines, Graeme Geldenhuys maintains a version that works with FPC.

Hello,

Thank you, I have code from DCrypt but I was looking for something much more simple which can generate the keys/certificates and handle all operations or at least sign/check-sign, even a 32 bits algo would be valid :-)

Anyway thank you, your answer confirms my suspects.

Reply by email

Виктор Матузенко
to José Mejuto

Hi,

try this https://github.com/delphi-pascal-archive/Pascal-RSA

пт, 5 апр. 2019 г. в 14:17, José Mejuto :

Show quoted text 19 lines
El 05/04/2019 a las 13:01, Michael Van Canneyt escribió: > Maybe DCrypt has the necessary routines, Graeme Geldenhuys maintains a > version that works with FPC. Hello, Thank you, I have code from DCrypt but I was looking for something much more simple which can generate the keys/certificates and handle all operations or at least sign/check-sign, even a 32 bits algo would be valid :-) Anyway thank you, your answer confirms my suspects. -- _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Victor Matuzenko (Виктор Матузенко)

Reply by email

Jy V
to José Mejuto: Is there any public/private key algorithm, pascal only, implemented in the distribution…

---------------------------------

José Mejuto wrote
Is there any public/private key algorithm, pascal only, implemented in

the distribution of fpc ? Degree of security is not important, also a 3rd party unit which does not depends on a DLL or depends on another software to generate key pairs, or other tasks, would be valid too. ---------------------------------

Give a in Ultibo project at github, from memory it requires very few other pascal unit (and of course no external library or obscure binary code)

I also know that XMLRAD is sharing similar feature in unit XCrypto.pas, the project is hosted at SourceForge (and still of course no external library or obscure binary code).

Reply by email

José Mejuto
to Jy V
Jy V wrote 7 lines
Give a in Ultibo project at github, from memory it requires very few other pascal unit (and of course no external library or obscure binary code) I also know that XMLRAD is sharing similar feature in unit XCrypto.pas, the project is hosted at SourceForge (and still of course no external library or obscure binary code).

Hello,

Thank you, I'll put an eye on both of them.

Reply by email

Santiago A.
to José Mejuto: Thank you. It is a bit "monster" but maybe I can split the necessary code. Thank you…
José Mejuto wrote 10 lines
El 05/04/2019 a las 19:08, Виктор Матузенко escribió: > Hi, > > try this https://github.com/delphi-pascal-archive/Pascal-RSA > Hello, Thank you. It is a bit "monster" but maybe I can split the necessary code. Thank you again.

There is no simple solution for a complex problem. RSA implies a lot of backend: several symmetric ciphers (AES, Blowfish..., that are complex by their own. You don't want to use Caesar cypher), acceptable random generator, big integer arithmetic,  prime numbers,  several hash algorithms.
And the library is leaving aside all PKI stuff: certificates, authorities  etc. And forget about memory protection etc I think it is a minimal RSA lib. In fact, maybe it's too simple. As far as I've seen it only has MD5 and SHA1 hash algorithms, many environments require at least sha256. But if it is only for internal use (you are in charge of both ends of communication) and not for critical top secret, it could be enough. I don't think you will find anything much more simpler.

Saludos Santiago A.

Reply by email

Jy V
to Santiago A.
AM Santiago A. wrote
There is no simple solution for a complex problem. I don't think you will find anything much more simpler.

Santiago, you should reconsider, the original poster asked for PublicKey/PrivateKey algorithm,
in ECC.pas from XMLRAD hosted at SourceForge the unit is 1K line of pure pascal,
this unit provide essential elements with 4 functions, it may give you ideas how simple it could be while providing ECDSA256 (secp256r1) which the de-facto high security standard as-of april 2019:

function EccMakeKey(out PublicKey: TPublicKey; out PrivateKey:
TPrivateKey): Boolean;
function EcdhSharedSecret(const PublicKey: TPublicKey; const PrivateKey:
TPrivateKey; out Secret: TEccSecretKey): Boolean;
function EcdsaSign(const PrivateKey: TPrivateKey; const Hash: TEccHash; out
Signature: TSignature): Boolean;
function EcdsaVerify(const PublicKey: TPublicKey; const Hash: TEccHash;
const Signature: TSignature): Boolean;

Reply by email

José Mejuto
to Santiago A.: There is no simple solution for a complex problem. RSA implies a lot of backend: several…
Santiago A. wrote 12 lines
There is no simple solution for a complex problem. RSA implies a lot of backend: several symmetric ciphers (AES, Blowfish..., that are complex by their own. You don't want to use Caesar cypher), acceptable random generator, big integer arithmetic,  prime numbers,  several hash algorithms. And the library is leaving aside all PKI stuff: certificates, authorities  etc. And forget about memory protection etc I think it is a minimal RSA lib. In fact, maybe it's too simple. As far as I've seen it only has MD5 and SHA1 hash algorithms, many environments require at least sha256. But if it is only for internal use (you are in charge of both ends of communication) and not for critical top secret, it could be enough. I don't think you will find anything much more simpler.

Hello,

For serious stuff complex libraries are needed, I know, but in this case a simple algo like a XOR (if it was a public/private key one) would be enough. The only requirement is that the "client" can not generate easily commands so the generation key must not be compiled in the code. It is not a security algo, it's more like make it difficult and nothing more, no real security is broken if the choose code is broken.

Reply by email