Skip to content

Instantly share code, notes, and snippets.

View Vanethos's full-sized avatar
⚒️
WIP

Gonçalo Palma Vanethos

⚒️
WIP
View GitHub Profile
@Vanethos
Vanethos / rsa_pem.dart
Created March 5, 2019 21:59 — 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-----",