rsa_encrypt
rsa_encrypt copied to clipboard
parsePublicKeyFromPem: type 'ASN1Object' is not a subtype of type 'ASN1Sequence' in type cast
I want to encrypt using the public key of the String I have.
I got an error with parsePublicKeyFromPem
.
- Code
var helper = RsaKeyHelper();
// a base64 encoded pem string with correct headers and footers
final publicKeyString = '...';
final publicKey = helper.parsePublicKeyFromPem(publicKeyString);
- Error
The following _CastError was thrown while handling a gesture:
type 'ASN1Object' is not a subtype of type 'ASN1Sequence' in type cast
When the exception was thrown, this was the stack:
#0 RsaKeyHelper.parsePublicKeyFromPem (package:rsa_encrypt/rsa_encrypt.dart:60:47)
#1 HomeScreenContent.build._openNotification (package:app/garage/pages/home/MY_SCREEN.dart:43:32)
#2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19)
#3 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1111:38)
#4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
- flutter --version
Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9b2d32b605 (8 months ago) • 2021-01-22 14:36:39 -0800
Engine • revision 2f0af37152
Tools • Dart 2.10.5
Do you know the solution? Thank you.