|
316 | 316 | memberchk(PubKeyString, Key.x5c),
|
317 | 317 | string_length(PubKeyString, StrLength),
|
318 | 318 | wrap_key(PubKeyString, 0, 64, StrLength, "", WrappedKey),
|
319 |
| - format(string(PubKeyFormatted), |
320 |
| - "-----BEGIN PUBLIC KEY-----~n~s~n-----END PUBLIC KEY-----", |
| 319 | + format(string(CertFormatted), |
| 320 | + "-----BEGIN CERTIFICATE-----~n~s~n-----END CERTIFICATE-----", |
321 | 321 | [WrappedKey]),
|
322 |
| - tmp_file_stream(text, File, Stream), |
323 |
| - write(Stream, PubKeyFormatted), |
| 322 | + tmp_file_stream(text, FileTmpCert, TmpStreamCert), |
| 323 | + write(TmpStreamCert, CertFormatted), |
| 324 | + close(TmpStreamCert), |
| 325 | + process_create(path(openssl), ['x509', '-pubkey', '-in', FileTmpCert, '-noout'], |
| 326 | + [ |
| 327 | + stdout(pipe(Stream)), |
| 328 | + detached(false), |
| 329 | + process(PID) |
| 330 | + ]), |
| 331 | + tmp_file_stream(text, File, StreamTmp), |
| 332 | + copy_stream_data(Stream, StreamTmp), |
| 333 | + close(StreamTmp), |
324 | 334 | close(Stream),
|
| 335 | + process_wait(PID, _), |
325 | 336 | atom_string(KidAtom, Key.kid),
|
326 | 337 | atom_string(AlgAtom, Key.alg),
|
327 | 338 | SettingsKey = _{kid: KidAtom,
|
|
0 commit comments