[OTR-dev] Otr failed to parse q parameter after import

Mohamed Akram Tabka tabkram at gmail.com
Thu Sep 5 07:51:35 EDT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
I'm working on an Otr key importer and when trying to import an otr key
with Jitsi and parse p,q,g,x and y parameters I got always an empty q
parameter.

I'm getting KeyPair from file the same way that Jitsi does.
here is the code :


> public KeyPair construct(String privK,String pubK) { // Load
> Private Key. byte[] privKey = privK.getBytes();  // Load Private
> Key. byte[] b64PrivKey = Base64.decodeBase64(privKey); if
> (b64PrivKey == null) return null;  PKCS8EncodedKeySpec
> privateKeySpec = new PKCS8EncodedKeySpec(b64PrivKey);
> 
> // Load Public Key. byte[] pubKey = pubK.getBytes(); byte[]
> b64PubKey = Base64.decodeBase64(pubKey);  if (b64PubKey == null) 
> return null;
> 
> 
> X509EncodedKeySpec publicKeySpec = new
> X509EncodedKeySpec(b64PubKey); PublicKey publicKey; PrivateKey
> privateKey; // Generate KeyPair. KeyFactory keyFactory; try { 
> keyFactory = KeyFactory.getInstance("DSA"); publicKey =
> keyFactory.generatePublic(publicKeySpec); privateKey =
> keyFactory.generatePrivate(privateKeySpec); } catch
> (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } 
> catch (InvalidKeySpecException e) { e.printStackTrace(); return
> null; } keyPair =new KeyPair(publicKey, privateKey); return new
> KeyPair(publicKey, privateKey); }

 then I'm trying to get parameters this way :

> System.out.println(" p:  #"+parmPriv.get("p")+"#"); 
> System.out.println(" q:#"+parmPriv.get("q")+"#"); 
> System.out.println(" g:  #"+parmPriv.get("g")+"#"); 
> System.out.println(" y:  #"+ parmPub.get("y")+"#"); 
> System.out.println(" x:  #"+ parmPriv.get("x")+"#");

and always the q parameter is empty .
Am asking how can I get this parameter , does anyone have an idea ?

All bests,

- --
Mohamed Akram Tabka
Tech intern at Access | akram at accessnow.org
Student at the National School of Computer Sciences
PGP ID : 0x82000BEF
PGP FingerPrint : 40DF DB6B D10B 107B 7609 362F 1045 B72D 8200 0BEF
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSKHBHAAoJEBBFty2CAAvvSeUH/is9WDhjdENj6GDN/imFhDOh
qdmcUU3Ofidj+DC/1aLnqSC9zIfcKnVIfTxUZcPB7hIILAkfUfjhl0MPi35iYz1C
dAsJRBOLgChMjjIHtkvu5CsTm/J+jUHUzyh4cctAWys/6KFlDFE1dSGiFxrl4efS
74M+4d/Z7I8dt8VNBQBtyCp/pyEWBRrxhtGHq+Uzz1m1NS69JN3G8UxAsPC8KKhb
m3oGlTRLUBJ9AZ0u0AAlnLClbV4p1ux7zHKzPFOzH9mUuGL3OHq1KZWMxQLGi9t/
5YEF8qAsi7yiIlIdZkbYmxBwAZx2YzKv6G0kUikw55zZfMz++l+oyrLVghS6/38=
=427y
-----END PGP SIGNATURE-----



More information about the OTR-dev mailing list