Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68882

TypeError in HMAC module.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prabir.kr.sarkar@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '__init__': 0.09; 'calculating': 0.09; 'skip:k 40': 0.09; 'api': 0.11; 'python': 0.11; 'hashed': 0.16; 'integer,': 0.16; 'typeerror:': 0.16; 'trying': 0.19; 'advance.': 0.19; 'issue.': 0.22; 'unicode': 0.24; 'script': 0.25; 'skip:" 30': 0.26; 'rest': 0.29; 'character': 0.29; 'errors': 0.30; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; 'running': 0.33; 'call.': 0.33; 'received:google.com': 0.35; 'version': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'new': 0.61; '*thanks': 0.91; 'regards*': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=CH6zOUbe0g+syZ/U7kuJzl319qZECWQBqxSbPxQZs8Y=; b=fW5rgWO3IlETgM1dpVCK0JAu81u44PnW6v5dFdmH5IdGLnvHA06wXQ6yPa/WD7mkxz zC74y0+EYVdpycGfQ/iM4jQy6wCbxFqeogb587TEJmRkPQY4zuRR0R9y7WEWq2RPWAix aiTHTiPY1Hl1u32OWlzoqnMdM4ykN9UYtyYloqh7abB06J3DCeyhr1RQkm/QZkkwonBh +JFuqiSfrvGv4I1sU8/AqDOpfTh8mVRn467QNcDMvRlWBFHSyFCjTSc8MU+9SyGBAVHH jJUB2cENrr1ic57CldL83khLcs49aW1NW+1E5SNBjPFsqKKDEYaTBTPo6RRs5nTqJ01n acDg==
MIME-Version 1.0
X-Received by 10.60.226.138 with SMTP id rs10mr57940729oec.7.1395674108870; Mon, 24 Mar 2014 08:15:08 -0700 (PDT)
Date Mon, 24 Mar 2014 20:45:08 +0530
Subject TypeError in HMAC module.
From Prabir Kr Sarkar <prabir.kr.sarkar@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=001a1136b9d47b459604f55bb390
X-Mailman-Approved-At Mon, 24 Mar 2014 16:15:35 +0100
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8450.1395674136.18130.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395674136 news.xs4all.nl 2873 [2001:888:2000:d::a6]:39619
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68882

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,
   I am trying to create a hashed message for authentication for a REST API
call. I have got the key from a keyring as :-

key = keyring.get_password('AWS_keyring','username')

& calculating the signature as :-
signature = hmac(key, message.encode('UTF-8'),
hashlib.sha1).digest().encode('base64')[:-1]

But, while running the script I get the following errors :-

  File "/usr/lib64/python2.6/hmac.py", line 133, in new
    return HMAC(key, msg, digestmod)
  File "/usr/lib64/python2.6/hmac.py", line 72, in __init__
*    self.outer.update(key.translate(trans_5C))*
*TypeError: character mapping must return integer, None or unicode*

My python version is :-

# python -V
Python 2.6.9

Can someone please help me as to how I can resolve this issue. Thanks in
advance.

-- 
*Thanks and Regards*
*Prabir Sarkar*

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

TypeError in HMAC module. Prabir Kr Sarkar <prabir.kr.sarkar@gmail.com> - 2014-03-24 20:45 +0530

csiph-web