推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
mcoo1997
V2EX  ›  Python

求助 Python 用 RSA 签名报错

  •  
  •   mcoo1997 · Dec 3, 2016 · 3185 views
    This topic created in 3454 days ago, the information mentioned may be changed or developed.

    import rsa signature = rsa.sign(code2, RSA_PRIVATE, 'SHA-1')

    报错: Traceback (most recent call last): File "D:/paython/test.py", line 104, in <module> signature = rsa.sign(code2, RSA_PRIVATE, 'SHA-1') File "C:\Python27\lib\rsa\pkcs1.py", line 276, in sign keylength = common.byte_size(priv_key.n) AttributeError: 'str' object has no attribute 'n'

    求助!

    3 replies    2016-12-05 11:04:52 +08:00
    Kilerd
        1
    Kilerd  
       Dec 3, 2016 via iPhone
    很明显,参数传入不正确
    mcoo1997
        2
    mcoo1997  
    OP
       Dec 4, 2016
    @Kilerd code2 是字符串 key 用几种格式试了都是这个结果
    mcoo1997
        3
    mcoo1997  
    OP
       Dec 5, 2016
    小白求助大家
    Google 搜了下也没找到解决方案
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5324 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 08:29 · PVG 16:29 · LAX 01:29 · JFK 04:29
    ♥ Do have faith in what you're doing.