@@ -69,6 +69,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
6969 const keybuf = randomBytes ( 32 ) ;
7070 const key = createSecretKey ( keybuf ) ;
7171 assert . strictEqual ( key . type , 'secret' ) ;
72+ assert . strictEqual ( key . toString ( ) , '[object KeyObject]' ) ;
7273 assert . strictEqual ( key . symmetricKeySize , 32 ) ;
7374 assert . strictEqual ( key . asymmetricKeyType , undefined ) ;
7475 assert . strictEqual ( key . asymmetricKeyDetails , undefined ) ;
@@ -150,27 +151,32 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
150151
151152 const publicKey = createPublicKey ( publicPem ) ;
152153 assert . strictEqual ( publicKey . type , 'public' ) ;
154+ assert . strictEqual ( publicKey . toString ( ) , '[object KeyObject]' ) ;
153155 assert . strictEqual ( publicKey . asymmetricKeyType , 'rsa' ) ;
154156 assert . strictEqual ( publicKey . symmetricKeySize , undefined ) ;
155157
156158 const privateKey = createPrivateKey ( privatePem ) ;
157159 assert . strictEqual ( privateKey . type , 'private' ) ;
160+ assert . strictEqual ( privateKey . toString ( ) , '[object KeyObject]' ) ;
158161 assert . strictEqual ( privateKey . asymmetricKeyType , 'rsa' ) ;
159162 assert . strictEqual ( privateKey . symmetricKeySize , undefined ) ;
160163
161164 // It should be possible to derive a public key from a private key.
162165 const derivedPublicKey = createPublicKey ( privateKey ) ;
163166 assert . strictEqual ( derivedPublicKey . type , 'public' ) ;
167+ assert . strictEqual ( derivedPublicKey . toString ( ) , '[object KeyObject]' ) ;
164168 assert . strictEqual ( derivedPublicKey . asymmetricKeyType , 'rsa' ) ;
165169 assert . strictEqual ( derivedPublicKey . symmetricKeySize , undefined ) ;
166170
167171 const publicKeyFromJwk = createPublicKey ( { key : publicJwk , format : 'jwk' } ) ;
168172 assert . strictEqual ( publicKey . type , 'public' ) ;
173+ assert . strictEqual ( publicKey . toString ( ) , '[object KeyObject]' ) ;
169174 assert . strictEqual ( publicKey . asymmetricKeyType , 'rsa' ) ;
170175 assert . strictEqual ( publicKey . symmetricKeySize , undefined ) ;
171176
172177 const privateKeyFromJwk = createPrivateKey ( { key : jwk , format : 'jwk' } ) ;
173178 assert . strictEqual ( privateKey . type , 'private' ) ;
179+ assert . strictEqual ( privateKey . toString ( ) , '[object KeyObject]' ) ;
174180 assert . strictEqual ( privateKey . asymmetricKeyType , 'rsa' ) ;
175181 assert . strictEqual ( privateKey . symmetricKeySize , undefined ) ;
176182
0 commit comments