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

Bls12381G2 key created with Askar vs Mattr based on same seed give different key #219

Open
TimoGlastra opened this issue Jan 31, 2024 · 2 comments

Comments

@TimoGlastra
Copy link
Contributor

TimoGlastra commented Jan 31, 2024

Is it expected that the same seed as input for Bls12381G2 key in the Mattr key generator from seed, results in the same private key being generated in Askar?

The seed testseed000000000000000000000001, gives me the following results (base64 encoded)

{
  mattrKey: 'tkKNXrPdZPclfBOlfJVp96+RQLH28zqC809wHsPBtH4S3rpQ1GezEaXaswI6sVrFBcFYuUB+efEgYwu8X2nk7II4VswwTfup9J3l+YODt9Tv6TKdu9t3uPlUepRY0Yur',
  askarKey: 'pcXFzjM1/CR9Jq/1fN0C3CZhk1IUNntgXiqPqy8Zf/dco63UbXbHnVpl0YZ0O9SABuSzuQEQ71T66SWMNwC92A0kHTfB6gz0IAbOF2nP4X4JNAfP41W+sV+BpCl2plsh'
}
@TimoGlastra
Copy link
Contributor Author

@andrewwhitehead
Copy link
Contributor

andrewwhitehead commented May 24, 2024

The method the bbs crate uses to generate keys from a seed is here: https://github.com/hyperledger/aries-bbssignatures-rs/blob/main/src/keys.rs#L331

This method is similar to the BLS keygen algorithm, but with Blake2 as the hash algorithm, and a different salt value. Askar currently offers the BLS keygen algorithm as an option when using Key.from_seed("bls12381g2", seed, method="bls_keygen") (in the Python wrapper) so a compatible version could be added based on this method: https://github.com/hyperledger/aries-askar/blob/e2b6f97fd65a691dd5bfd4446478af5a81c793f2/askar-crypto/src/alg/bls.rs#L257

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

No branches or pull requests

2 participants