openssh_ed25519 1.1.0 copy "openssh_ed25519: ^1.1.0" to clipboard
openssh_ed25519: ^1.1.0 copied to clipboard

Serialize an ed25519 key into the openssh format

Dart Package for serializing ed25519 keys into the openssh format

Usage #

import 'dart:io';

import 'package:cryptography/cryptography.dart';
import 'package:openssh_ed25519/openssh_ed25519.dart';

Future<void> main() async {
  final keyPair = await Ed25519().newKeyPair();

  var privateBytes = await keyPair.extractPrivateKeyBytes();
  var public = await keyPair.extractPublicKey();
  var publicBytes = public.bytes;

  var publicStr = encodeEd25519Public(publicBytes);
  var privateStr = encodeEd25519Private(
    privateBytes: privateBytes,
    publicBytes: publicBytes,
  );

  await File('id_ed25519.pub').writeAsString(publicStr);
  await File('id_ed25519').writeAsString(privateStr);
}
1
likes
140
points
382
downloads

Publisher

verified publishergitjournal.io

Weekly Downloads

Serialize an ed25519 key into the openssh format

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

More

Packages that depend on openssh_ed25519