toPem method
Implementation
String toPem() {
final writer = SSHMessageWriter();
writer.writeBytes(Uint8List.fromList(magic.codeUnits));
writer.writeUint8(0); // terminator of magic
writer.writeUtf8(cipherName);
writer.writeUtf8(kdfName);
writer.writeString(kdfOptions?.encode() ?? Uint8List(0));
writer.writeUint32(publicKeys.length);
for (var i = 0; i < publicKeys.length; i++) {
writer.writeString(publicKeys[i]);
}
writer.writeString(privateKeyBlob);
return SSHPem('OPENSSH PRIVATE KEY', {}, writer.takeBytes()).encode(70);
}