11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (!common.hasCrypto) 51cb0ef41Sopenharmony_ci common.skip('missing crypto'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst { 91cb0ef41Sopenharmony_ci generateKeyPairSync, 101cb0ef41Sopenharmony_ci} = require('crypto'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci// Test sync key generation with key objects with a non-standard 131cb0ef41Sopenharmony_ci// publicExponent 141cb0ef41Sopenharmony_ci{ 151cb0ef41Sopenharmony_ci const { publicKey, privateKey } = generateKeyPairSync('rsa', { 161cb0ef41Sopenharmony_ci publicExponent: 3, 171cb0ef41Sopenharmony_ci modulusLength: 512 181cb0ef41Sopenharmony_ci }); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci assert.strictEqual(typeof publicKey, 'object'); 211cb0ef41Sopenharmony_ci assert.strictEqual(publicKey.type, 'public'); 221cb0ef41Sopenharmony_ci assert.strictEqual(publicKey.asymmetricKeyType, 'rsa'); 231cb0ef41Sopenharmony_ci assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { 241cb0ef41Sopenharmony_ci modulusLength: 512, 251cb0ef41Sopenharmony_ci publicExponent: 3n 261cb0ef41Sopenharmony_ci }); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci assert.strictEqual(typeof privateKey, 'object'); 291cb0ef41Sopenharmony_ci assert.strictEqual(privateKey.type, 'private'); 301cb0ef41Sopenharmony_ci assert.strictEqual(privateKey.asymmetricKeyType, 'rsa'); 311cb0ef41Sopenharmony_ci assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { 321cb0ef41Sopenharmony_ci modulusLength: 512, 331cb0ef41Sopenharmony_ci publicExponent: 3n 341cb0ef41Sopenharmony_ci }); 351cb0ef41Sopenharmony_ci} 36