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

add ecc encrypt&decrypt #2597

Merged
merged 22 commits into from
Sep 15, 2021

Conversation

doubiliu
Copy link
Contributor

@doubiliu doubiliu commented Sep 1, 2021

Close #2594

@Jim8y
Copy link
Contributor

Jim8y commented Sep 3, 2021

Test cases crash the dotnet on my Macbook.

Its this code that cause the crash:

using var cipher = new AesGcm(keyBytes);

@ZhangTao1596
Copy link

ZhangTao1596 commented Sep 6, 2021

Test cases crash the dotnet on my Macbook.

Its this code that cause the crash:

using var cipher = new AesGcm(keyBytes);

AesGcm depends on [email protected]. But there is LibreSSL as default in maxOS.

  1. install openssl brew install [email protected]
  2. Add export DYLD_LIBRARY_PATH="/usr/local/opt/[email protected]/lib" in env variables
  3. Use dotnet test --filter "FullyQualifiedName=Neo.UnitTests.Cryptography.UT_Cryptography_Helper.TestECEncryptAndDecrypt" run the test.

@Jim8y
Copy link
Contributor

Jim8y commented Sep 6, 2021

@ZhangTao1596 Thank you, will try it out

Jim8y
Jim8y previously approved these changes Sep 6, 2021
Jim8y
Jim8y previously approved these changes Sep 6, 2021
nicolegys
nicolegys previously approved these changes Sep 7, 2021
@doubiliu doubiliu dismissed stale reviews from nicolegys and Jim8y via 0ce2977 September 10, 2021 12:13

public static byte[] AES256Decrypt(this byte[] encryptedData, byte[] key, byte[] associatedData = null)
{
if (key.Length != 32) throw new ArgumentException();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check encryptedData length?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key length,which is checked here. It should be 32 bytes when we use a AES gcm mode

shargon
shargon previously approved these changes Sep 14, 2021
@erikzhang
Copy link
Member

Merge?

@shargon shargon merged commit 778feed into neo-project:master Sep 15, 2021
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

Successfully merging this pull request may close these issues.

Add ECC encryption and decryption tool method to core
7 participants