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

aws iot create-certificate-from-csr Error: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal #2535

Closed
gojimmypi opened this issue Apr 7, 2017 · 3 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.

Comments

@gojimmypi
Copy link

gojimmypi commented Apr 7, 2017

This is similar error message to s3 sync/ls issues UnicodeWarning in Windows environment but not s3 sync so I am creating a new issue.

I am following the instructions here:

http://blogs.paasmer.co/series-blogs-connect-esp-8266-nodemcu-aws-iot/#comment-377

To connect ESP8266 / NodeMCU to AWS IoT with these commands:

openssl ecparam -out ecckey.key -name prime256v1 -genkey
openssl req -new -sha256 -key ecckey.key -nodes -out eccCsr.csr

specifically when using this (step 2.3) command from the AWS CLI:

aws iot create-certificate-from-csr -–certificate-signing-request file://eccCsr.csr –certificate-pem-outfile eccCert.crt –set-as-active

I see this error:

$ aws iot create-certificate-from-csr -–certificate-signing-request file:eccCsr.csr –certificate-pem-outfile eccCert.crt –set-as-active
C:\python27\lib\argparse.py:2140: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if option_string == short_option_prefix:
Traceback (most recent call last):
  File "C:/Users/gojimmypi/AppData/Roaming/Python/Scripts/aws", line 27, in <module>
    sys.exit(main())
  File "C:/Users/gojimmypi/AppData/Roaming/Python/Scripts/aws", line 23, in main
    return awscli.clidriver.main()
  File "C:\Users\gojimmypi\AppData\Roaming\Python\Python27\site-packages\awscli\clidriver.py", line 54, in main
    return driver.main()
  File "C:\Users\gojimmypi\AppData\Roaming\Python\Python27\site-packages\awscli\clidriver.py", line 189, in main
    parsed_args, remaining = parser.parse_known_args(args)
  File "C:\Users\gojimmypi\AppData\Roaming\Python\Python27\site-packages\awscli\argparser.py", line 91, in parse_known_args
    parsed, remaining = super(CLIArgParser, self).parse_known_args(args, namespace)
  File "C:\python27\lib\argparse.py", line 1733, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "C:\python27\lib\argparse.py", line 1774, in _parse_known_args
    option_tuple = self._parse_optional(arg_string)
  File "C:\python27\lib\argparse.py", line 2082, in _parse_optional
    option_tuples = self._get_option_tuples(arg_string)
  File "C:\python27\lib\argparse.py", line 2144, in _get_option_tuples
    elif option_string.startswith(option_prefix):
UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 1: ordinal not in range(128)

Windows 10, using git bash.

$ aws --version
aws-cli/1.11.74 Python/2.7.13 Windows/10 botocore/1.5.37

I tried opening & re-saving files from Notepad++ (thinking perhaps it was a Unicode/encoding problem?). no luck.

@stealthycoin
Copy link
Contributor

aws iot create-certificate-from-csr -–certificate-signing-request file:eccCsr.csr –certificate-pem-outfile eccCert.crt –set-as-active

Couple things about this line. First it looks like you have ndashes instead of hyphens (ndash is 0x96)
Second your argument for the certificate-signing-request parameter command starts with file: instead of file:// in one of the commands you posted, it's correct in the other one.

@stealthycoin stealthycoin added closing-soon This issue will automatically close in 4 days unless further comments are made. question labels Apr 7, 2017
@gojimmypi
Copy link
Author

thanks for your reply! indeed you are quite correct, my reckless copy/paste had converted some of the dashes to "evil dashes"! (ugh, who'd have known)... and also as it turns out, apparently all of the parameters need two preceding dashes, not just one as shown above.

so after deleting and re-typing all the dashes in Notepad, this is the corrected command that works:

aws iot create-certificate-from-csr --certificate-signing-request file://eccCsr.csr --certificate-pem-outfile eccCert.crt --set-as-active

@gojimmypi
Copy link
Author

gojimmypi commented Apr 7, 2017

btw - if using file instead of file:// I received this error:

An error occurred (InvalidRequestException) when calling the CreateCertificateFromCsr operation: Invalid CSR format

@diehlaws diehlaws added guidance Question that needs advice or information. and removed question labels Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants