MCPcopy Create free account
hub / github.com/mscdex/ssh2 / genOpenSSLEdPub

Function genOpenSSLEdPub

lib/protocol/keyParser.js:229–247  ·  view source on GitHub ↗
(pub)

Source from the content-addressed store, hash-verified

227}
228
229function genOpenSSLEdPub(pub) {
230 const asnWriter = new Ber.Writer();
231 asnWriter.startSequence();
232 // algorithm
233 asnWriter.startSequence();
234 asnWriter.writeOID('1.3.101.112'); // id-Ed25519
235 asnWriter.endSequence();
236
237 // PublicKey
238 asnWriter.startSequence(Ber.BitString);
239 asnWriter.writeByte(0x00);
240 // XXX: hack to write a raw buffer without a tag -- yuck
241 asnWriter._ensure(pub.length);
242 asnWriter._buf.set(pub, asnWriter._offset);
243 asnWriter._offset += pub.length;
244 asnWriter.endSequence();
245 asnWriter.endSequence();
246 return makePEM('PUBLIC', asnWriter.buffer);
247}
248
249function genOpenSSHEdPub(pub) {
250 const publicKey = Buffer.allocUnsafe(4 + 11 + 4 + pub.length);

Callers 2

parseOpenSSHPrivKeysFunction · 0.85
parseDERFunction · 0.85

Calls 1

makePEMFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…