Skip to content
This repository was archived by the owner on Dec 23, 2020. It is now read-only.

enhance the functions of ECPublicKey and ECPrivateKey, and add ECDH f…#192

Open
ipconfiger wants to merge 1 commit into
PointyCastle:masterfrom
ipconfiger:master
Open

enhance the functions of ECPublicKey and ECPrivateKey, and add ECDH f…#192
ipconfiger wants to merge 1 commit into
PointyCastle:masterfrom
ipconfiger:master

Conversation

@ipconfiger

Copy link
Copy Markdown

enhance the functions of ECPublicKey and ECPrivateKey, and add ECDH function in ECPrivateKey

@stevenroose

Copy link
Copy Markdown
Member

Thanks for the contribution, I left some comments!

@stevenroose stevenroose left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm, comments didn't get through..

Comment thread lib/ecc/api.dart
}

/// Restore privatekey from stored hex string
static ECPrivateKey fromStored(String storedPriKey, ECDomainParameters domainParams){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you rename this fromHex instead? Someone could store a private key in base64 as well, f.e..

Comment thread lib/ecc/api.dart
String hexString() => this.d.toRadixString(16);

/// Generate publickey from private key
ECPublicKey generatePubkey(){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rename to just ECPublicKey get publicKey {.

Comment thread lib/ecc/api.dart
return new ECPublicKey(Q, this.parameters);
}

Uint8List generateSecret(ECPublicKey pubkey) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait is this Shamir's secret sharing? I would certainly not name this generateSecret. I'm not sure if this method should be on PrivateKey, but if it's here, please explicitly mention that it's for secret sharing. F.e.

/// Create a shared secret using Shamir's secret sharing scheme.
Uint8List getSharedSecret(ECPublicKey other) {

Comment thread lib/ecc/api.dart
}

/// return Uint8List so can easily stored or transfer on internet
Uint8List getEncoded(){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

toBytes()? Perhaps also add hexString() that encodes as hex. And perhaps also a toBytes on PrivateKey as well?

Comment thread lib/ecc/api.dart
}

/// restore public key from Uint8List from stored string or internet
static ECPublicKey fromStored(Uint8List theQ, ECDomainParameters domainParams){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fromBytes?

Why do you do bytes for public key and hex string for private key? Quite inconsistent.. I'd either just have bytes on both or hex on both or both on both.

@izaera

izaera commented Dec 23, 2020

Copy link
Copy Markdown
Member

I'm archiving this repo as per #239 (see the issue for more info).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants