@@ -170,3 +170,34 @@ const privatePem = fixtures.readSync('test_rsa_privkey.pem', 'ascii');
170170 createPrivateKey ( { key : '' } ) ;
171171 } , / n u l l / ) ;
172172}
173+
174+ [
175+ { private : fixtures . readSync ( 'test_ed25519_privkey.pem' , 'ascii' ) ,
176+ public : fixtures . readSync ( 'test_ed25519_pubkey.pem' , 'ascii' ) ,
177+ keyType : 'ed25519' } ,
178+ { private : fixtures . readSync ( 'test_ed448_privkey.pem' , 'ascii' ) ,
179+ public : fixtures . readSync ( 'test_ed448_pubkey.pem' , 'ascii' ) ,
180+ keyType : 'ed448' }
181+ ] . forEach ( ( info ) => {
182+ const keyType = info . keyType ;
183+
184+ {
185+ const exportOptions = { type : 'pkcs8' , format : 'pem' } ;
186+ const key = createPrivateKey ( info . private ) ;
187+ assert . strictEqual ( key . type , 'private' ) ;
188+ assert . strictEqual ( key . asymmetricKeyType , keyType ) ;
189+ assert . strictEqual ( key . symmetricKeySize , undefined ) ;
190+ assert . strictEqual ( key . export ( exportOptions ) , info . private ) ;
191+ }
192+
193+ {
194+ const exportOptions = { type : 'spki' , format : 'pem' } ;
195+ [ info . private , info . public ] . forEach ( ( pem ) => {
196+ const key = createPublicKey ( pem ) ;
197+ assert . strictEqual ( key . type , 'public' ) ;
198+ assert . strictEqual ( key . asymmetricKeyType , keyType ) ;
199+ assert . strictEqual ( key . symmetricKeySize , undefined ) ;
200+ assert . strictEqual ( key . export ( exportOptions ) , info . public ) ;
201+ } ) ;
202+ }
203+ } ) ;
0 commit comments