Xor-el / CryptoLib4Pascal

Crypto for Modern Object Pascal
MIT License
213 stars 65 forks source link

How to convert public and private keys from PKCS#8 format to the hexadecimal arrays used by the library? #40

Closed PauloDouglas closed 4 months ago

PauloDouglas commented 5 months ago

Xor-el, initially I would like to thank you for making your library available. Using the example contained in the ED25519Cripto.pas unit, I was able to formulate a function to return the signature, but the input and output are in hexadecimal arrays, but my public and private keys are strings in PKCS#8 format (generated by AsymmetricKeyGenerator-setup- v0.5.3). How to convert public and private keys from PKCS#8 format to the hexadecimal arrays used by the library? As for the payload, in ansi format, I also have doubts about how to properly convert it to the hexadecimal arrays used by the library.

Thank you in advance for your help.

Paulo.

Xor-el commented 4 months ago

Hello @PauloDouglas my apologies, just seeing this now. Must have missed the notifications. Have you been able to resolve this?

PauloDouglas commented 4 months ago

Oi Xor-el, ainda não. Estou partindo para o desespero e tentando fazer uma DLL em Python kkkk Agradeceria imensamente se puder me ajudar nisso

Xor-el commented 4 months ago

Hello @PauloDouglas the bytes format accepted by my library should be encoded in DER format. this means you have to use an external tool or write some Delphi code to convert your keys from the PKCS#8 format to the native DER format supported by my library.

PauloDouglas commented 4 months ago

Muito obrigado Xor-el, vou pesquisar aqui e ver como fazer essa conversão!

PauloDouglas commented 4 months ago

Grato!