GithubHelp home page GithubHelp logo

Comments (5)

mathiasertl avatar mathiasertl commented on June 10, 2024

Hi @bandirom,

Thanks for the report!

There is a kind of hidden issue with yoru test case: Django itself says you should use call_command(), but in reality that skips the parsing of the argument parser. So when you call manage.py init_ca ... --ecc-curve secp256r1, the command function will actually receive an ec.EllipticCurve object, but with call_command() it won't. But we rely heavily on argparse parsing to parse strings into cryptography objects.

You have three options:

  1. Not test with an ECC curve as you did - probably not what you want.
  2. Pass the correct cryptography object.
  3. Make use of the same, undocumented trick that we use: https://github.com/mathiasertl/django-ca/blob/main/ca/django_ca/tests/base/mixins.py#L606-L608

I think this should solve the issue for you?

kr, Mat

from django-ca.

mathiasertl avatar mathiasertl commented on June 10, 2024

PS: I have checked the default value (where it says ABCMeta in your screenshot) and verified that this only affects the output of the default value for --help. The actual default value is not wrong.

from django-ca.

mathiasertl avatar mathiasertl commented on June 10, 2024

closing this issue. If you need further assistance please reopen or create a new issue.

from django-ca.

bandirom avatar bandirom commented on June 10, 2024

Sorry, didnt have a time to reply. Im from Ukraine :)
I will check when will be able :)
Thank you!

from django-ca.

bandirom avatar bandirom commented on June 10, 2024

Hi!
I've fixed this bug.
for correct parsing need to provide values to call_command() as args not kwargs.

I mean the next one:

args = [
      '--key-type', 'RSA',
      '--key-size', '4096',
      '--algorithm', 'sha512',
      '--expires', '3650',
]

call_command('init_ca', 'example', '/some/subject', *args)

and it will be handled properly :)

I believe it can be described in some docs section

from django-ca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.