Skip to content

Instantly share code, notes, and snippets.

View M3ales's full-sized avatar

Matthew M3ales

  • Luna Software Solutions
  • South Africa
  • 05:41 (UTC +02:00)
View GitHub Profile
@M3ales
M3ales / rsa_pem.dart
Created September 5, 2022 09:41 — forked from proteye/rsa_pem.dart
How to encode/decode RSA private/public keys to PEM format in Dart with asn1lib and pointycastle
import 'dart:convert';
import 'dart:math';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "package:asn1lib/asn1lib.dart";
List<int> decodePEM(String pem) {
var startsWith = [
"-----BEGIN PUBLIC KEY-----",
"-----BEGIN PRIVATE KEY-----",