(data: string | Buffer | Uint8Array)
| 112 | } |
| 113 | |
| 114 | export function to_hex(data: string | Buffer | Uint8Array): string { |
| 115 | if (typeof data === 'string') { |
| 116 | return Buffer.from(data).toString('hex'); |
| 117 | } |
| 118 | if (data instanceof Uint8Array) { |
| 119 | return Buffer.from(data).toString('hex'); |
| 120 | } |
| 121 | return (data as Buffer).toString('hex'); |
| 122 | } |
| 123 | |
| 124 | function x509key_to_uint8array(pem: string, max_length?: number) { |
| 125 | const content = pem.replace(/-----BEGIN PRIVATE KEY-----/, '') |