Documentation for EcdhPrivateKey.deriveBits could have bullet point list mentining the maximum length of bits that can be derived from each curve.
Example
[length] specifies the length of the derived secret in bits. The maximum length depends on the [EllipticCurve] used in the keys:
...
* [EllipticCurve.p521] can provide up to 528 bits.
See:
|
/// Derive a shared secret from two ECDH key pairs using the private key from one pair |
|
/// and the public key from another. |
|
/// |
|
/// The shared secret is identical whether using A's private key and B's public key, |
|
/// or B's private key and A's public key, enabling secure key exchange between the |
|
/// two parties. |
|
/// |
|
/// [length] specifies the length of the derived secret in bits. |
|
/// [publicKey] is [EcdhPublicKey] from the other party's ECDH key pair. |
|
/// |
|
/// Returns a [Uint8List] containing the derived shared secret. |
|
/// |
|
/// {@macro EcdhPrivateKey:example} |
|
// Note some webcrypto implementations (chrome, not firefox) supports passing |
|
// null for length (in this primitive). However, you can always know the right |
|
// length from the curve. Note p512 can provide up to: 528 bits!!! |
|
// |
|
// See: https://tools.ietf.org/html/rfc6090#section-4 |
|
// Notice that this is not uniformly distributed, see also: |
|
// https://tools.ietf.org/html/rfc6090#appendix-B |
|
Future<Uint8List> deriveBits(int length, EcdhPublicKey publicKey); |
Documentation for
EcdhPrivateKey.deriveBitscould have bullet point list mentining the maximum length of bits that can be derived from each curve.Example
See:
webcrypto.dart/lib/src/webcrypto/webcrypto.ecdh.dart
Lines 185 to 205 in b295d8d