Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'digest': 0.04; 'subject:Python': 0.06; 'subject:support': 0.07; 'utf-8': 0.07; "'')": 0.09; 'msg': 0.09; 'must,': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'porting': 0.16; 'subject:???': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'java': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; 'context.': 0.31; 'sep': 0.31; 'run': 0.32; 'fri,': 0.33; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'two': 0.37; 'pm,': 0.38; 'does': 0.39; 'generating': 0.39; "you're": 0.61; 'back': 0.62; 'different': 0.65; 'here': 0.66; 'frank': 0.68; '*simple*': 0.84; 'to:none': 0.92; 'subject:Android': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=InUGXFdvOYNjjCVrGqVVkfOCW8crtETBclgteaKefm4=; b=Nz5j1hcNTe3eEIZl+66q7Ttu7dJUcZqAmJ2Owtjmj8q499vBXcRtF+I4jRKFnxwNa1 iO+HuNnTCTjkUL03ey0BDZkIMkILgd8JB/BuLyS81rCtPFtFVyIOEYvrLJN9x+iabEd6 wFd+9wPwhrLUspVZTKfRDXAIzw++v7mrCmw1Y/0wCWM+z8ai/22X6mQO6TkiUXFVmmWY SbaW1Z2NG7VMWWJbfuqy3blqySE7GalGszQdwAh5dmU9vXD3gt32jetqfw6aXKuPZqe2 C47e5btjjopL2jeiZOTnqLrHQtIV40nS+ZCyCiH1k63Na8QGaDJVqq3ATYg/kho2D5e4 4hYg== MIME-Version: 1.0 X-Received: by 10.43.96.65 with SMTP id cf1mr12121000icc.26.1409903275625; Fri, 05 Sep 2014 00:47:55 -0700 (PDT) In-Reply-To: <5bacfff0-246f-4c97-b8ba-5f6ce45acf29@googlegroups.com> References: <614897cb-6a2f-4059-a713-05c0cd2b3cd5@googlegroups.com> <5bacfff0-246f-4c97-b8ba-5f6ce45acf29@googlegroups.com> Date: Fri, 5 Sep 2014 17:47:55 +1000 Subject: Re: Python Crypto Singature do not support Android??? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409903284 news.xs4all.nl 2947 [2001:888:2000:d::a6]:49288 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77581 On Fri, Sep 5, 2014 at 5:23 PM, Frank Liou wrote: > here is my code > > python : > > msg = '123' > msg = msg.encode('utf-8') > digest = SHA.new(msg).digest() > signature = APP_key_Private.sign(digest, '') That code is incomplete, I can't run it. Ditto your Java code. But what seems to be happening is that you're getting data back in two very different formats, plus you're generating one signature based on a UTF-8 stream and one based on a Base-64 stream. Start by writing *simple* code that does what you want, and then porting that to the other language exactly. Also, please don't use Google Groups, or if you must, please remember to include context. ChrisA