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

Read mdm.cer in MDM_Vendor_Sign.py fails in Windows #25

Open
TomSelleck opened this issue Mar 11, 2015 · 4 comments
Open

Read mdm.cer in MDM_Vendor_Sign.py fails in Windows #25

TomSelleck opened this issue Mar 11, 2015 · 4 comments

Comments

@TomSelleck
Copy link

Problem code is:

p('Verifying %s ... ' % cli_args['mdm'])
mdm_cert_file = open(cli_args['mdm']).read()
args = ['openssl', 'x509', '-noout', '-inform', 'DER' ]
command = subprocess.Popen(args, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
output, error = command.communicate(input = mdm_cert_file)  

Error is as follows:

'unable to load certificate\r\n8240:error:0D06B08E:asn1 encoding   routines:ASN1_D2I_READ_BIO:not enough data:.\\crypto\\asn1\\a_d2i_fp.c:234:\r\n'

Simple and quick solution is to read file as binary as follows:

with open(cli_args['mdm'], 'rb') as f:
        mdm_cert_file = f.read()
        args = ['openssl', 'x509', '-noout', '-inform', 'DER' ]
        command = subprocess.Popen(args, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
        output, error = command.communicate(input = mdm_cert_file)  
         ....
@MaximilianoRios
Copy link

I've already pushed a request to fix it because I noted that some time ago. Hope someone merges it.

@thrasr
Copy link

thrasr commented Jun 17, 2015

I haven't seen a pull request fixing this issue. Can you resubmit it?

@MaximilianoRios
Copy link

The fix is pushed to grinich/mdmvendorsign, where the code is located.

https://github.com/grinich/mdmvendorsign/pulls

Regards.

On Tue, Jun 16, 2015 at 11:47 PM, Rory Thrasher [email protected]
wrote:

I haven't seen a pull request fixing this issue. Can you resubmit it?


Reply to this email directly or view it on GitHub
#25 (comment)
.

@thrasr
Copy link

thrasr commented Jun 17, 2015

Ahhhh, I misunderstood where the error was. I'll leave this open so that others can see it until the request is accepted.

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

3 participants