MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / x509key_to_uint8array

Function x509key_to_uint8array

sdk/js/src/index.ts:124–137  ·  view source on GitHub ↗
(pem: string, max_length?: number)

Source from the content-addressed store, hash-verified

122}
123
124function x509key_to_uint8array(pem: string, max_length?: number) {
125 const content = pem.replace(/-----BEGIN PRIVATE KEY-----/, '')
126 .replace(/-----END PRIVATE KEY-----/, '')
127 .replace(/\n/g, '');
128 const binaryDer = atob(content)
129 if (!max_length) {
130 max_length = binaryDer.length
131 }
132 const result = new Uint8Array(max_length)
133 for (let i = 0; i < max_length; i++) {
134 result[i] = binaryDer.charCodeAt(i)
135 }
136 return result
137}
138
139function replay_rtmr(history: string[]): string {
140 const INIT_MR = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

Callers 2

asUint8ArrayMethod · 0.85
asUint8ArrayMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected