#1 [[Question]] Signing a Private RSA Key with SHA256 and a String?

Closed
opened 5 years ago by WammKD · 1 comments
WammKD commented 5 years ago

I was wondering if I'd be able to do as the subject line says with this library.

Namely, I'm trying to replicate some Ruby code: Base64.strict_encode64(keypair.sign(OpenSSL::Digest::SHA256.new, "string")). I'm, specifically, looking at the keypair.sign(OpenSSL::Digest::SHA256.new, "string") part, right now.

Is there a way to do that with this library?

Also of curiosity, does it provide Base64 as well? I worked on my own module of it not that long ago but I could just use this library's if I'm able to do the signing with it.

Thanks for any help!

I was wondering if I'd be able to do as the subject line says with this library. Namely, I'm trying to replicate some Ruby code: `Base64.strict_encode64(keypair.sign(OpenSSL::Digest::SHA256.new, "string"))`. I'm, specifically, looking at the `keypair.sign(OpenSSL::Digest::SHA256.new, "string")` part, right now. Is there a way to do that with this library? Also of curiosity, does it provide Base64 as well? I worked on my own module of it not that long ago but I could just use this library's if I'm able to do the signing with it. Thanks for any help!
civodul commented 1 year ago
Collaborator

It's veeery late, but yes, you can do that with this library.

To compute a hash, use sha256 from (guix hash), as in:

(use-modules (gcrypt hash) (rnrs bytevectors))

(sha256 (string->utf8 "Some string."))

And there's now a complete sign/verify example in the manual, in the "Public-Key Cryptography" section.

HTH!

It's veeery late, but yes, you can do that with this library. To compute a hash, use `sha256` from `(guix hash)`, as in: ```scheme (use-modules (gcrypt hash) (rnrs bytevectors)) (sha256 (string->utf8 "Some string.")) ``` And there's now a complete sign/verify example in the manual, in the "Public-Key Cryptography" section. HTH!
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.