xref: /third_party/node/test/parallel/test-crypto-keygen-async-dsa-key-object.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
1'use strict';
2
3const common = require('../common');
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7const assert = require('assert');
8const {
9  generateKeyPair,
10} = require('crypto');
11
12// Test async DSA key object generation.
13{
14  generateKeyPair('dsa', {
15    modulusLength: common.hasOpenSSL3 ? 2048 : 512,
16    divisorLength: 256
17  }, common.mustSucceed((publicKey, privateKey) => {
18    assert.strictEqual(publicKey.type, 'public');
19    assert.strictEqual(publicKey.asymmetricKeyType, 'dsa');
20    assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {
21      modulusLength: common.hasOpenSSL3 ? 2048 : 512,
22      divisorLength: 256
23    });
24
25    assert.strictEqual(privateKey.type, 'private');
26    assert.strictEqual(privateKey.asymmetricKeyType, 'dsa');
27    assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {
28      modulusLength: common.hasOpenSSL3 ? 2048 : 512,
29      divisorLength: 256
30    });
31  }));
32}
33

Indexes created Thu Nov 07 10:32:03 CST 2024