jeroen / openssl

OpenSSL bindings for R
Other
64 stars 22 forks source link

Export fingerprint? #17

Closed richfitz closed 8 years ago

richfitz commented 8 years ago

Any chance you could export the fingerprint function? I have a use case where being able to get the hash of a public key would be useful.

jeroen commented 8 years ago

You can use as.list on the pubkey to get its fingerprint:

key <- rsa_keygen()
pubkey <- as.list(key)$pubkey
as.list(pubkey)$fingerprint

Does that help?

jeroen commented 8 years ago

edit: actually this already works in the cran version

richfitz commented 8 years ago

OK, brilliant. That's all I need.

jeroen commented 8 years ago

Can I know your use case? Note that this fingerprint is the md5 hash of the ssh pubkey, which is the thing that you see in your ssh client. But some other systems might use a different algorithm to derive a fingerprint...

richfitz commented 8 years ago

This is for the data encryption package (https://github.com/dide-tools/encryptr) - I want something that I can use for the filename of a public key and user-specific encrypted data key that is somewhat collision resistant and repeatable. So the fingerprint is nice because I can go from the users public key to the appropriate filename.