Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Implement Necessary LibSodium Primitives in Golang #210

Closed
Moopli opened this issue Sep 4, 2019 · 6 comments
Closed

Implement Necessary LibSodium Primitives in Golang #210

Moopli opened this issue Sep 4, 2019 · 6 comments
Assignees

Comments

@Moopli
Copy link
Contributor

Moopli commented Sep 4, 2019

For interoperability with related projects (eg, ACA-Py), we need to use or reimplement certain libsodium primitives (for example, crypto_box_seal), some of which are not available in golang.org/x/crypto (for example, golang.org/x/crypto/nacl/box.Seal is equivalent to NaCl crypto_box_easy, despite the name)

@Moopli Moopli changed the title Wrap NaCl Box to match libsodium primitives Wrap golang crypto primitives to match libsodium primitives Sep 4, 2019
@Moopli
Copy link
Contributor Author

Moopli commented Sep 4, 2019

The current primitives we know we need are equivalent to NaCl crypto_box_seal and crypto_box_seal_open. I've implemented and tested them in my fork of the golang libsodium wrapper: https://github.com/Moopli/libsodium-go/blob/master/cryptobox/crypto_box_seal_test.go

How we should regression-test these is an open question - do we introduce a testing-only dependency to GoKillers/libsodium-go? Do we accept that these functions are tested on a fork of another repo, and that they won't be broken someday once we begin using them?

@Moopli
Copy link
Contributor Author

Moopli commented Sep 4, 2019

@troyronda assign me

@Moopli
Copy link
Contributor Author

Moopli commented Sep 12, 2019

Looks like we'll need an equivalent to:

  • crypto_sign_ed25519_pk_to_curve25519
  • crypto_sign_ed25519_sk_to_curve25519

For python interop.

The secret key conversion is done, but the public key conversion requires elliptic curve arithmetic, which is implemented in /x/crypto but not exposed.

@Moopli
Copy link
Contributor Author

Moopli commented Sep 12, 2019

Found a way to avoid reimplementing ed25519 -> curve25519 key conversion - testing against ACA-Py is the only reason we're working with key conversions, and testcases and keys can be generated in Python, so no key conversion needs to be done in Go.

@Moopli Moopli changed the title Wrap golang crypto primitives to match libsodium primitives Implement necessary libsoium primitives in golang Sep 17, 2019
@Moopli Moopli changed the title Implement necessary libsoium primitives in golang Implement Necessary LibSodium Primitives in Golang Sep 17, 2019
@Moopli
Copy link
Contributor Author

Moopli commented Sep 24, 2019

Update: key conversion mentioned above was indeed necessary for ACA-Py interop - keys need to be transmitted as Ed255519 keys, and encryption (eg, of CEK) is done using their Curve25519 counterparts.

@Moopli
Copy link
Contributor Author

Moopli commented Sep 25, 2019

Key conversion was implemented in #292

Closing for now, can reopen if we find more primitives are needed.

@Moopli Moopli closed this as completed Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant