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