Skip to content

add private key validation test#1357

Closed
martgil wants to merge 20 commits intomasterfrom
add-private-key-validation-test
Closed

add private key validation test#1357
martgil wants to merge 20 commits intomasterfrom
add-private-key-validation-test

Conversation

@martgil
Copy link
Collaborator

@martgil martgil commented Feb 2, 2022

This PR will add a private key validation test and update PgpKey class

close #1346 // if this PR closes an issue

issue #0000 // if it doesn't close the issue yet

Todo:

  • validate private key in readMany() of pgp-keys.ts
  • eliminate errors TypeError { message: 'prvPacket.validate is not a function' }
  • complete the test for unencrypted private key, encrypted private key validation.

reference: FlowCrypt/flowcrypt-browser#4271


Tests (delete all except exactly one):

  • Tests will be added later (issue #...)
  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@martgil martgil requested a review from sosnovsky as a code owner February 2, 2022 07:10
@martgil martgil marked this pull request as draft February 2, 2022 07:10
…1342)

* #1253 add fesUrl to RawClientConfiguration

* add testIsUsingFes test

* merge updates

* #1352 temporary disable simctl on semaphore
@martgil
Copy link
Collaborator Author

martgil commented Feb 2, 2022

@IvanPizhenko sorry for any disturbance, sir. I would like to ask for any hints?

I'm trying to achieve the same way that sir, Roman did on FlowCrypt/flowcrypt-browser#4271 when validating the key.
I keep getting the error of prvPacket.validate is not a function even though I've added the .validate(): Promise<any>; on openpgp.d.ts type definition file. I feel like I'm still missing something but not sure exactly what it is.

I also tried to find any references for the .validate() but I only get results from the openpgp.d.ts and openpgp-keys.ts(browser extension) / pgpkey.ts(ios-repo)

Any feedback would be much appreciated 🙇🏻‍♂️ Thanks!

@IvanPizhenko
Copy link
Contributor

@martgil .d.ts file is just type definitions for the Typescript compiler, it does not provide function implementation. I think browser extension may use modified version of openpgp.js with such custom function added. You better ask Roman about this.

@tomholub
Copy link
Collaborator

tomholub commented Feb 2, 2022

Likely, flowcrypt-ios uses an older version of OpenPGP.js than browser extension does.

@IvanPizhenko we could update the iOS OpenPGP.js to v5 (instead of FES, initially), what do you think? It won't be an easy task.

* #953 add 'reply all' message action

* #953 add ui test for 'reply all'

* update checkAddedRecipient helper

* after merge fix

* improve recipient evaluation

* pr updates
@IvanPizhenko
Copy link
Contributor

@tomholub yes, we can try to do it.

@tomholub tomholub mentioned this pull request Feb 3, 2022
sosnovsky and others added 17 commits February 4, 2022 18:54
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.14 to 17.0.15.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* issue 1358 remove DataService

* Build fixed

* UserId property in AppContextWithUser

* Code review fixes

Co-authored-by: Ivan Ushakov <ivan.ushakov@gmail.com>
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.15 to 17.0.16.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Working on moving strings to localization files

* Add keys to Localizable

* Fix unit tests

* Enable showNonLocalizedStrings for debug scheme

* Fixes for localizations

* Minor fix

* Change selector for ok button

* Add localizePluralsWithArguments for localizations
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.16 to 17.0.17.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.17 to 17.0.18.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dmitry Sotnikov <dmytro.s@accel-labs.com>
* wip issue 1362

* update local copy

* add old version for reference

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix build script

* wip

* wip

* wip

* wip

* cleanup and formatting

* comment about key.getExpirationTime()

* refactor (algoInfo as any)

* remove unnecessary code

* fix encrypt

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* clarify error messages in the lastSig()

* deduplicate preparation of encryptionKeys

* add block

* update build script

* remove test.sh

* fix gitignore

* remove random()

* indicate origin of the str_to_hex()

* wip

* latestValidKeyBindingSig

* str_to_hex LGPL

* wip

* Add web-stream-tools

* wip

* import readToEnd() from web-stream-tools

* added ambiets.d.ts

* wip

* added web-stream-tools.d.ts

* patch web-stream-tools

* wip

* Change type of PrvKeyInfo.decrypted to PrivateKey

* revert to openpgp.js patch

* import web-stream-tools

* clean up

* cleanup

* remove openpgp.d.ts

* fix path

* remove reference to .d.ts

* added todos

* use Math.max() in the lastSig()

Co-authored-by: Ivan Pizhenko <Ivan.Pizhenko@users.noreply.github.com>
Co-authored-by: tomholub <info@nvimp.com>
Co-authored-by: Roma Sosnovsky <roma.sosnovsky@gmail.com>
@martgil martgil closed this Feb 21, 2022
@tomholub tomholub deleted the add-private-key-validation-test branch April 14, 2022 12:47
@tomholub tomholub restored the add-private-key-validation-test branch April 14, 2022 12:47
@tomholub tomholub deleted the add-private-key-validation-test branch May 18, 2022 15:43
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.

Missing private key packets validation when importing/retrieving private key

7 participants