Advertisement
Guest User

Untitled

a guest
May 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public void run()
  2. {
  3. while (true)
  4. {
  5. try
  6. {
  7. gniazdko=listener.accept();
  8. Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
  9. cipher.init(Cipher.DECRYPT_MODE,C.kluczPrywatny);
  10.  
  11. //in = new ObjectInputStream(new CipherInputStream(gniazdko.getInputStream(),cipher));
  12.  
  13. in = new ObjectInputStream((gniazdko.getInputStream()));
  14.  
  15. //odp = (paczka)in.readObject();
  16.  
  17. byte [] O = (byte[])in.readObject();
  18. ByteArrayOutputStream BAOS = new ByteArrayOutputStream();
  19. CipherOutputStream COS = new CipherOutputStream(BAOS, cipher);
  20. COS.write(O);
  21. byte [] B = BAOS.toByteArray();
  22.  
  23. System.out.println("Coś przyszło");
  24. //System.out.println(odp.toString());
  25. System.out.println(new String(B));
  26. //System.out.println(C.deszyfruj(odp.szyfrowana));
  27. }
  28. catch (Exception e)
  29. {
  30. System.out.println(e.toString());
  31. }
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement