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

[PS-2215] Implement scrypt key derivation function #2285

Closed
wants to merge 2 commits into from

Conversation

quexten
Copy link
Contributor

@quexten quexten commented Jan 10, 2023

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

This pull request implements the scrypt kdf, as the second kdf next to pbkdf2.
The corresponding pull request on the clients repository is here:

Edit @djsmith85: Community forum thread: https://community.bitwarden.com/t/scrypt-kdf-support/48148/1

Code changes

There is also a pull request for the clients implementation here: bitwarden/clients/pull/4428

  • CryptoPrimitiveService.cs (iOS, Android), ICryptoPrimitiveService.cs: Implement the basic scrypt call.
  • KdfType.cs: Add the second KdfType
  • PclCryptoFunctionService.cs, ICryptoFunctionService.cs: Add the Scrypt functions
  • CryptoService: Add the scrypt case case for the kdf type. The default iterations are set to 2^16, and the minimum iterations are set to 2^15. (https://words.filippo.io/the-scrypt-parameters/ recommends 2^15 for interactive logins, but the article is from 2017 and it is arguable that bitwarden is closer to file encryption than interactive logins, so I'm open to debate here). The rest of the parameters are the same as recommended in the linked post.
  • iOS.Core.csproj: Add the BouncyCastle library (which is already used on Android) to implement Scrypt

I will note that I only tested this on Android, as I do not have a working iOS testing setup. It is the same implementation, but if it still does not work, let me know and I'm happy to fix it :)

@bitwarden-bot
Copy link

Thank you for your contribution! We've added this to our internal Community PR board for review.
ID: PS-2215

@bitwarden-bot bitwarden-bot changed the title Implement scrypt key derivation function [PS-2215] Implement scrypt key derivation function Jan 10, 2023
@quexten
Copy link
Contributor Author

quexten commented Jan 16, 2023

Closing, as we are focusing on argon2 instead.

@quexten quexten closed this Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants