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

Bad state no element (or user erroe? #84

Closed
domain-centric opened this issue Feb 3, 2022 · 14 comments
Closed

Bad state no element (or user erroe? #84

domain-centric opened this issue Feb 3, 2022 · 14 comments

Comments

@domain-centric
Copy link

ℹ️ Info

Version: 2.8.8

💬 "flutter pub run msix:create" results in: "Bad state no element" when getting certificate

Enter a description of your problem here.

flutter pub run msix:create
✓ parsing cli arguments
✓ validating config values
✓ cleaning temporary files
✓ creating app icons folder
✓ copying app icons
✓ copying VC libraries
❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚ 46% getting certificate publisher.. Certificate Details: ================ Certificate 0 ================
================ Begin Nesting Level 1 ================
Element 0:
Serial Number: 01
Issuer: EMPTY
NotBefore: 03/02/2022 9:23 am
NotAfter: 03/02/2032 9:23 am
Subject: EMPTY
Signature matches Public Key
Root Certificate: Subject matches Issuer
Cert Hash(sha1): 33480eede81bcaff00f82458c8dceba1ed67d5ba
---------------- End Nesting Level 1 ----------------
Provider = Microsoft Enhanced Cryptographic Provider v1.0
Encryption test passed
CertUtil: -dump command completed successfully.

Bad state: No element
This error happen when this package tried to read the certificate details,
please report it by pasting all this output (after deleting sensitive info) to:
https://github.com/YehudaKremer/msix/issues

#0 ListMixin.lastWhere (dart:collection/list.dart:180:5)
#1 SignTool.getCertificatePublisher (package:msix/src/signTool.dart:47:12)

#2 SignTool.getCertificatePublisher (package:msix/src/signTool.dart:54:22)

#3 Msix.createMsix (package:msix/msix.dart:44:7)

pub finished with exit code -1

📜 Pubspec.yaml

name: meyn_lbh_simulation
description: Meyn live bird handling simulation

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
collection: ^1.15.0

dev_dependencies:
flutter_test:
sdk: flutter
msix: ^2.8.8

windows installer (msix):

* see: https://pub.dev/packages/msix

* Add msxi config section in pubspec.yaml

* from command line: flutter build windows

* from command line (run as admin): flutter pub run msix:create

* output: build\windows\runner\Release\meyn_lbh_simulation.msix

create certificate file (once)

* download app: https://sourceforge.net/projects/xca/postdownload

* create certificate

* Export as PKCS#12

* Store in project folder root with pkf extension, e.g.: meyn_lbh_simulation.pfx

For information on the generic Dart part of this file, see the

following page: https://dart.dev/tools/pub/pubspec

The following section is specific to Flutter.

flutter:

uses-material-design: true

msix_config:
certificate_path: C:\Users\nilsth\AndroidStudioProjects\meyn_lbh_simulation\meyn_lbh_simulation.p12
certificate_password: secret
We ask that you include your pubspec.yaml file as a common problem we have seen has been the pubspec.yaml file being incorrect

@YehudaKremer
Copy link
Owner

hello

can you try with .pfx certification type intended of .p12

@domain-centric
Copy link
Author

Changing the extension results in the same problem. It seems to read the file fine (with both extensions) because the Cert Hash(sha1) is correct...

The .p12 file was created using XCA.

@YehudaKremer
Copy link
Owner

i see, you can use the signtool_options option to use different digest algorithm

see:
https://github.com/YehudaKremer/msix#black_nib-signing-options
https://github.com/YehudaKremer/msix#-configuring-your-installer (see sample using signtool_options in the configuration table)
also official documentation of sign Command Options :https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe#sign-command-options

please update me if you able to solve the problem

@YehudaKremer
Copy link
Owner

is it test certificate? can you share it?

@domain-centric
Copy link
Author

Sure! files.zip

@YehudaKremer
Copy link
Owner

image

@domain-centric
Copy link
Author

Oeps: password in yaml is: meyn_lbh_simulation (changed it to paste in the above)

Still same problem...

@YehudaKremer
Copy link
Owner

okay

i think the problem is that is no Subject to this certificate (is "EMPTY")

please generate this certificate again, but this time set a value in the common field:
image

please update if its solve the problem

@domain-centric
Copy link
Author

It still resulted an empty subject.

Filling in the other attributes resulted in:
flutter pub run msix:create
✓ parsing cli arguments
✓ validating config values
✓ cleaning temporary files
✓ creating app icons folder
✓ copying app icons
✓ copying VC libraries
❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚ 46% getting certificate publisher.. Unhandled exception:
type 'String' is not a subtype of type 'GeneralException'
#0 SignTool.getCertificatePublisher (package:msix/src/signTool.dart:37:44)

#1 Msix.createMsix (package:msix/msix.dart:44:7)

pub finished with exit code 255

@domain-centric
Copy link
Author

Any alternative suggestions how to create a pfx file on a win10 computer?

@YehudaKremer
Copy link
Owner

wait, the error "type 'String' is not a subtype of type 'GeneralException'" is msix package bug,
can you please use latest version 2.8.12 and try again, then we will see the real error log

@YehudaKremer
Copy link
Owner

XCA is a good tool for certifications creations,
i successfully create msix with certificate created by XCA

i can try to help you create valid certificate for msix installer

@domain-centric
Copy link
Author

Works perfect now!

Thanks so much for you great and speedy support.
I am so happy with msix. Great work!

@YehudaKremer
Copy link
Owner

Thank you for reporting this problem 👍

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

2 participants