getKeyPair method
Passes the key pair of certificate
for usage with
platformKeys.subtleCrypto
to callback
.
|certificate|: The certificate of a Match returned by
selectClientCertificates.
|parameters|: Determines signature/hash algorithm parameters additionally
to the parameters fixed by the key itself. The same parameters are
accepted as by WebCrypto's importKey
function, e.g. RsaHashedImportParams
for a RSASSA-PKCS1-v1_5
key and EcKeyImportParams
for EC key.
Additionally for RSASSA-PKCS1-v1_5 keys, hashing algorithm name parameter
can be specified with one of the following values: "none", "SHA-1",
"SHA-256", "SHA-384", or "SHA-512", e.g.
{"hash": { "name": "none" } }
. The sign function will then
apply PKCS#1 v1.5 padding but not hash the given data.
Currently, this method only supports the "RSASSA-PKCS1-v1_5" and
"ECDSA" algorithms.
Implementation
Future<GetKeyPairResult> getKeyPair(
ByteBuffer certificate,
Map parameters,
) {
var $completer = Completer<GetKeyPairResult>();
$js.chrome.platformKeys.getKeyPair(
certificate.toJS,
parameters.jsify()!,
(
JSAny publicKey,
JSAny? privateKey,
) {
if (checkRuntimeLastError($completer)) {
$completer.complete(GetKeyPairResult(
publicKey: publicKey.toDartMap(),
privateKey: privateKey?.toDartMap(),
));
}
}.toJS,
);
return $completer.future;
}