MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / decodeSAN

Function decodeSAN

modules/crypt/etc/x509.js:184–200  ·  view source on GitHub ↗
(buf)

Source from the content-addressed store, hash-verified

182 }
183 },
184 decodeSAN(buf) {
185 let b = this.decodeExtension(buf, [2, 5, 29, 17]); // Subject Alternative Name
186 if (!b) return;
187
188 b = new BER((new BER(b)).getSequence());
189
190 const names = [];
191 while (b.readable) {
192 const tag = b.getTag() & 0x7F;
193 let value = b.getChunk(b.getLength()).slice().buffer;
194 if ((2 === tag) || (1 === tag) || (6 === tag)) // IA5String: dNSName, rfc822Name, uniformResourceIdentifier
195 value = String.fromArrayBuffer(value);
196 names.push({tag, value});
197 }
198
199 return names;
200 },
201 decodeExtension(buf, extid) @ "xs_x509_decodeExtension",
202};
203

Callers

nothing calls this directly

Calls 7

getSequenceMethod · 0.80
getTagMethod · 0.80
getLengthMethod · 0.80
sliceMethod · 0.65
fromArrayBufferMethod · 0.65
getChunkMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected