Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to cryptonite? Deprecate in favor of cryptonite? #12

Open
nwf opened this issue Jun 22, 2015 · 5 comments
Open

Move to cryptonite? Deprecate in favor of cryptonite? #12

nwf opened this issue Jun 22, 2015 · 5 comments

Comments

@nwf
Copy link

nwf commented Jun 22, 2015

In light of http://tab.snarc.org/posts/haskell/2015-06-02-announcing_cryptonite.html the "crypto-pubkey-types" dependency is not long for the world, so this package should probably move over to the newer cryptonite. That also probably means shucking crypto-api's Crypto.Random in favor of cryptonite API, though I don't believe it's essential.

The core modules (src/Codec/Crypto/RSA/Exceptions.hs and src/Codec/Crypto/RSA/Pure.hs) seem easily enough moved, but the test harness (Test.hs) is a little more involved.

That said, cryptonite packages its own RSA implementation, so perhaps anything relevant from this package should go upstream there and this should be deprecated?

Thanks!

@acw
Copy link
Contributor

acw commented Jun 22, 2015

I think the better plan will be to simply remove the dependency on crypto-api and make the various libraries self-sufficient, thus providing two unrelated crypto libraries for Haskell.

@TomMD
Copy link
Contributor

TomMD commented Jun 22, 2015

The issue with depending on cryptonite, as I've discussed with Vincent in the past, is it strictly less powerful compared to crypto-api's Crypto.Random. For example the cryptonite class API DRG (vs crypto-api CryptoRandomGen) makes no reseeding possible, no additional entropy on request, and leans on exceptions instead of sum types so pure code can't recover from failure.

Other past complaints, such as non-determinism, seem to remain partially. Some issues are resolved but I do see the isProbablyPrime function is actually unsafe / nondeterministic. similarly, I wonder what happens if you CBC encrypt something using an incorrectly sized IV - is it still non-deterministic? The types provide no method for failure other than exceptions and the behavior of the prior package makes me suspicious.

WRT RSA in particular, it might be beneficial to simply accept a parameter that can provide a random value, be it by building over a MonadRandom m style type constraint or some other mechanism encoding a generator API. This avoids tying to any one framework but can lead to more crufty API too - yay for me not being Adam and letting him decide on this one.

EDIT: I see IVs now have smart constructors much how crypto-api has done things, so one should not be able to abuse IVs and CBC like in the past. This makes me much more comfortable.

@dbaynard
Copy link

dbaynard commented Aug 3, 2015

How about just replacing the crypto-pubkey-types dependency with one on cryptonite? The most recent x509 package imports the lattter, so the PublicKey data types from each are not compatible, despite being isomorphic.

(Unless there’s another way to import a public key from an external resource.)

@acw
Copy link
Contributor

acw commented Aug 4, 2015

'''cryptonite''' already includes an RSA implementation, so depending on it for the types seems weird.

That being said, I'm currently in the process of experimenting with translating a bunch of my existing code to cryptonite. If it turns out that it all goes smoothly, and I don't discover anything I disagree with too much or a missing piece I need, I'm actually leaning towards deprecating this package in favor of '''cryptonite'''.

@dbaynard
Copy link

dbaynard commented Aug 4, 2015

It does seem weird. I missed the existing implementation as the cryptonite docs aren’t on hackage.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants