remove more legacy otr decryption code
This commit is contained in:
		
							parent
							
								
									7fa8811f64
								
							
						
					
					
						commit
						9ca636589c
					
				| @ -119,7 +119,7 @@ public class HttpUploadConnection implements Transferable { | ||||
| 
 | ||||
| 		if (method == Method.P1_S3) { | ||||
| 			try { | ||||
| 				md5 = Checksum.md5(AbstractConnectionManager.createInputStream(file, true).first); | ||||
| 				md5 = Checksum.md5(AbstractConnectionManager.createInputStream(file).first); | ||||
| 			} catch (Exception e) { | ||||
| 				Log.d(Config.LOGTAG, account.getJid().asBareJid()+": unable to calculate md5()", e); | ||||
| 				fail(e.getMessage()); | ||||
| @ -131,7 +131,7 @@ public class HttpUploadConnection implements Transferable { | ||||
| 
 | ||||
| 		Pair<InputStream,Integer> pair; | ||||
| 		try { | ||||
| 			pair = AbstractConnectionManager.createInputStream(file, true); | ||||
| 			pair = AbstractConnectionManager.createInputStream(file); | ||||
| 		} catch (FileNotFoundException e) { | ||||
| 			Log.d(Config.LOGTAG, account.getJid().asBareJid()+": could not find file to upload - "+e.getMessage()); | ||||
| 			fail(e.getMessage()); | ||||
|  | ||||
| @ -39,7 +39,7 @@ public class AbstractConnectionManager { | ||||
|         this.mXmppConnectionService = service; | ||||
|     } | ||||
| 
 | ||||
|     public static Pair<InputStream, Integer> createInputStream(DownloadableFile file, boolean gcm) throws FileNotFoundException { | ||||
|     public static Pair<InputStream, Integer> createInputStream(DownloadableFile file) throws FileNotFoundException { | ||||
|         FileInputStream is; | ||||
|         int size; | ||||
|         is = new FileInputStream(file); | ||||
| @ -48,18 +48,11 @@ public class AbstractConnectionManager { | ||||
|             return new Pair<>(is, size); | ||||
|         } | ||||
|         try { | ||||
|             if (gcm) { | ||||
|                 Cipher cipher = Compatibility.twentyTwo() ? Cipher.getInstance(CIPHERMODE) : Cipher.getInstance(CIPHERMODE, PROVIDER); | ||||
|                 SecretKeySpec keySpec = new SecretKeySpec(file.getKey(), KEYTYPE); | ||||
|                 IvParameterSpec ivSpec = new IvParameterSpec(file.getIv()); | ||||
|                 cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); | ||||
|                 return new Pair<>(new CipherInputStream(is, cipher), cipher.getOutputSize(size)); | ||||
|             } else { | ||||
|                 IvParameterSpec ips = new IvParameterSpec(file.getIv()); | ||||
|                 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | ||||
|                 cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(file.getKey(), KEYTYPE), ips); | ||||
|                 return new Pair<>(new CipherInputStream(is, cipher), (size / 16 + 1) * 16); | ||||
|             } | ||||
|             Cipher cipher =  Cipher.getInstance(CIPHERMODE); | ||||
|             SecretKeySpec keySpec = new SecretKeySpec(file.getKey(), KEYTYPE); | ||||
|             IvParameterSpec ivSpec = new IvParameterSpec(file.getIv()); | ||||
|             cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); | ||||
|             return new Pair<>(new CipherInputStream(is, cipher), cipher.getOutputSize(size)); | ||||
|         } catch (Exception e) { | ||||
|             throw new AssertionError(e); | ||||
|         } | ||||
|  | ||||
| @ -476,11 +476,11 @@ public class JingleConnection implements Transferable { | ||||
| 				if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) { | ||||
| 					this.file.setKey(mXmppAxolotlMessage.getInnerKey()); | ||||
| 					this.file.setIv(mXmppAxolotlMessage.getIV()); | ||||
| 					pair = AbstractConnectionManager.createInputStream(this.file, true); | ||||
| 					pair = AbstractConnectionManager.createInputStream(this.file); | ||||
| 					this.file.setExpectedSize(pair.second); | ||||
| 					content.setFileOffer(this.file, false, this.ftVersion).addChild(mXmppAxolotlMessage.toElement()); | ||||
| 				} else { | ||||
| 					pair = AbstractConnectionManager.createInputStream(this.file, false); | ||||
| 					pair = AbstractConnectionManager.createInputStream(this.file); | ||||
| 					this.file.setExpectedSize(pair.second); | ||||
| 					content.setFileOffer(this.file, false, this.ftVersion); | ||||
| 				} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch