summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto/sig.ts
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-11-09 09:56:59 -0800
committerGitHub <noreply@github.com>2023-11-09 23:26:59 +0530
commitc4029f6af22b373bf22383453cb4e2159f3b5b72 (patch)
tree588594d5d5eb98689101565fb76c6a546cc9e78a /ext/node/polyfills/internal/crypto/sig.ts
parentee7fd0a2127e6a435023bf9a43de60130117697d (diff)
fix(node): implement createPrivateKey (#20981)
Towards #18455
Diffstat (limited to 'ext/node/polyfills/internal/crypto/sig.ts')
-rw-r--r--ext/node/polyfills/internal/crypto/sig.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/node/polyfills/internal/crypto/sig.ts b/ext/node/polyfills/internal/crypto/sig.ts
index ebbd11dc6..c5eb34fae 100644
--- a/ext/node/polyfills/internal/crypto/sig.ts
+++ b/ext/node/polyfills/internal/crypto/sig.ts
@@ -19,7 +19,10 @@ import type {
PrivateKeyInput,
PublicKeyInput,
} from "ext:deno_node/internal/crypto/types.ts";
-import { KeyObject } from "ext:deno_node/internal/crypto/keys.ts";
+import {
+ getKeyMaterial,
+ KeyObject,
+} from "ext:deno_node/internal/crypto/keys.ts";
import { createHash, Hash } from "ext:deno_node/internal/crypto/hash.ts";
import { KeyFormat, KeyType } from "ext:deno_node/internal/crypto/types.ts";
import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts";
@@ -87,9 +90,9 @@ export class SignImpl extends Writable {
keyType = "rsa";
keyFormat = "pem";
} else {
- // TODO(kt3k): Add support for the case when privateKey is a KeyObject,
- // CryptoKey, etc
- notImplemented("crypto.Sign.prototype.sign with non BinaryLike input");
+ keyData = getKeyMaterial(privateKey);
+ keyType = "rsa";
+ keyFormat = "pem";
}
const ret = Buffer.from(ops.op_node_sign(
this.hash.digest(),