openssh_ed25519 1.0.0 copy "openssh_ed25519: ^1.0.0" to clipboard
openssh_ed25519: ^1.0.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 'dart:typed_data';

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

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

  var privateBytes = Uint8List.fromList(await keyPair.extractPrivateKeyBytes());
  var public = await keyPair.extractPublicKey();
  var publicBytes = Uint8List.fromList(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
323
downloads

Publisher

verified publishergitjournal.io

Weekly Downloads

Serialize an ed25519 key into the openssh format

Homepage

Documentation

API reference

License

Apache-2.0 (license)

More

Packages that depend on openssh_ed25519