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


Groups > comp.lang.python > #77579

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

Newsgroups comp.lang.python
Date 2014-09-05 00:23 -0700
References <614897cb-6a2f-4059-a713-05c0cd2b3cd5@googlegroups.com>
Message-ID <5bacfff0-246f-4c97-b8ba-5f6ce45acf29@googlegroups.com> (permalink)
Subject Re: Python Crypto Singature do not support Android???
From Frank Liou <fk26541598fk@gmail.com>

Show all headers | View raw


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: (3313609575189770456309776952388055366479183814159935747487353823698464644111856144652004406811762087026328804664486509214841694613481763164909855307029962363047099944520695429504224843583313164533334332743470132105629096577439312314814238554088472504815623363978006284897433036223490623530076474911740732410,)


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("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX------",test_a_to64);
  Log.d("sdfgserthwrthhsrethwegerg------",Arrays.toString(a));

String sdf = Sign.sign(a,privateKey);
 Log.d("000000000000000000000------",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

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


Thread

Python Crypto Singature do not support Android??? Frank Liou <fk26541598fk@gmail.com> - 2014-09-05 00:02 -0700
  Re: Python Crypto Singature do not support Android??? Chris Angelico <rosuav@gmail.com> - 2014-09-05 17:11 +1000
  Re: Python Crypto Singature do not support Android??? Frank Liou <fk26541598fk@gmail.com> - 2014-09-05 00:23 -0700
    Re: Python Crypto Singature do not support Android??? Chris Angelico <rosuav@gmail.com> - 2014-09-05 17:47 +1000

csiph-web