Maybe it is a limitation of libgcrypt? All three return #t for me when
using libcrypto:

(require crypto crypto/libcrypto)
(crypto-factories libcrypto-factory)

Although I don't know the pros and cons of each, it seems the
libcrypto pros include this working, as well as it being installed by
default on macOS (at least for me on 10.11.6)?

On Tue, Dec 18, 2018 at 5:36 PM David Storrs <david.sto...@gmail.com> wrote:
>
> I'm trying to persist public/private keys to our database and having some 
> trouble:
>
>
> Welcome to Racket v6.11.
> > (require crypto crypto/gcrypt)
> > (crypto-factories gcrypt-factory)
> > (define key (generate-private-key 'rsa))
> > key
> (object:gcrypt-rsa-key% ...)
> > (define pub (pk-key->public-only-key key))
> > pub
> (object:gcrypt-rsa-key% ...)
> > (public-key=? key pub)
> #t
> > (public-key=? key (datum->pk-key (pk-key->datum key 'OneAsymmetricKey) 
> > 'OneAsymmetricKey))
> #f
> > (public-key=? key (datum->pk-key (pk-key->datum key 'RSAPrivateKey) 
> > 'RSAPrivateKey))
> #f
> > (public-key=? key (datum->pk-key (pk-key->datum key 'rkt-private) 
> > 'rkt-private))
> #f
>
> The docs state that GCrypt does not have the ability to recompute a public 
> key component form the data in a 'PrivateKeyInfo format, so that's no good.
>
> pk-keys are objects, not structs, and there doesn't appear to be any way to 
> say "here's a private key and a public key, composite them".
>
> This has to be a thing that people do, so what am I missing?
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to