private TextSecureAttachmentPointer createAttachmentPointer( MasterSecret masterSecret, PduPart part) throws InvalidPartException { try { MasterCipher masterCipher = new MasterCipher(masterSecret); long id = Long.parseLong(Util.toIsoString(part.getContentLocation())); byte[] key = masterCipher.decryptBytes(Base64.decode(Util.toIsoString(part.getContentDisposition()))); String relay = null; if (part.getName() != null) { relay = Util.toIsoString(part.getName()); } return new TextSecureAttachmentPointer(id, null, key, relay); } catch (InvalidMessageException | IOException e) { Log.w(TAG, e); throw new InvalidPartException(e); } }