Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsePublicKeyFromPem: type 'ASN1Object' is not a subtype of type 'ASN1Sequence' in type cast #16

Open
asa08 opened this issue Sep 22, 2021 · 0 comments

Comments

@asa08
Copy link

asa08 commented Sep 22, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant