Python Crypto Singature do not support Android???

2014-09-05 Thread Frank Liou
I use Privatekey sign a signature by android 

and then send to python 

python can't use public key to verify

and 

python signature result all is number

but 

android is number and english words

is that no support??
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Crypto Singature do not support Android???

2014-09-05 Thread Chris Angelico
On Fri, Sep 5, 2014 at 5:02 PM, Frank Liou fk2654159...@gmail.com wrote:
 I use Privatekey sign a signature by android

 and then send to python

 python can't use public key to verify

 and

 python signature result all is number

 but

 android is number and english words

 is that no support??

It would help if you showed us (a) the code, (b) the two different
results, and (c) what you're expecting to see.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Crypto Singature do not support Android???

2014-09-05 Thread Frank Liou
Sorry!!

here is my code

python :

msg = '123'
msg = msg.encode('utf-8')
digest = SHA.new(msg).digest()
signature = APP_key_Private.sign(digest, '')

signature like: 
(331360957518977045630977695238805536647918381415993574748735382369846464411185614465200440681176208702632880466448650921484169461348176316490985530702996236304709994452069542950422484358331316454332743470132105629096577439312314814238554088472504815623363978006284897433036223490623530076474911740732410,)


and android :

InputStream inPrivate = getResources().getAssets().open(PR1.pem);
PrivateKey privateKey = RSAUtils.loadPrivateKey(inPrivate);
Log.d(privateKey--,privateKey.toString());

 byte[] a = Sign.digest(123.getBytes());
  String test_a_to64  = Base64.encodeToString(a,Base64.DEFAULT);
  Log.d(X--,test_a_to64);
  Log.d(sdfgserthwrthhsrethwegerg--,Arrays.toString(a));

String sdf = Sign.sign(a,privateKey);
 Log.d(0--,Arrays.toString(sdf.getBytes()));

Android like:


[34, 68, 28, 72, -43, 7, -64, -127, -119, -44, 61, -53, -22, 112, -74, -122, 
-19, -127, -120, -43, 1, -55, 66, -47, -63, -128, 104, -97, 104, 65, -48, -120, 
-50, 117, 85, 86, -33, 37, -77, -26, -46, -59, -43, -42, -79, -9, -78, -26, 
-25, 5, 4, -104, 95, -120, -73, 123, 70, -11, 56, -10, -99, -126, -30, -3, -63, 
42, 45, 33, 36, 23, -52, 10, -4, -17, 8, 82, -61, 74, 43, -5, 44, 29, 127, 78, 
100, -88, -24, -61, -24, 3, -105, 4, 117, 71, 41, 74, 99, 23, 68, 112, -8, 
-105, 67, -68, -115, -27, -24, 114, -108, 28, 15, -85, -77, 49, -110, -10, -83, 
-58, -27, 34, 90, -52, 71, -72, 73, -5, -2, -56]



please help
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Crypto Singature do not support Android???

2014-09-05 Thread Chris Angelico
On Fri, Sep 5, 2014 at 5:23 PM, Frank Liou fk2654159...@gmail.com 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
-- 
https://mail.python.org/mailman/listinfo/python-list