×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Question How i can encrypt a file like a video ?

    I'm trying to protect data on my cell, somebody has an idea?

    Or how i can modify some bytes of the file (to make this unusable) and correct them when i open the file with my aplication?

    Any suggestions?

    Greeetings from Chile.
    ps, sorry for my english.

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: How i can encrypt a file like a video ?

    You can rely on device-supported, built-in encryption and key/certificate management support (e.g., OMA DRM), or you can build your own simple encryption/decryption hiding the key in your code or delivering it separately, or you can look into commercial license key management solutions.

  3. #3
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How i can encrypt a file like a video ?

    Hi smayorgac,

    when implementing/using an encryption algorithm in your code, be aware that a decompilation/reverse engineering could reveal the details of the algorithm itself, and so expose the encrypted files to a possible malicious decryption.

    Usually, having some part of the algorithm itself not stored on phone could partially help to avoid this (e.g.: you could let your users enter a password for encryption/decryption, without storing it on the device)

    Pit

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Re: How i can encrypt a file like a video ?

    Hi, thanks for the answers !

    But maybe i need a simplest solution.
    Now I am sending via OBEX PUSH a video file to a cellphone and i want limit the copy of these files to an anothers phones.
    First i thought on DRM protection, but does not work (transfer protected files through bluetooth).

    Then I think on other solution, as the aplication modify the video files to make them unusable when i do not work with them.

    Modify some bytes of the file or something similar!

    Is it understood?

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: How i can encrypt a file like a video ?

    If you just send/push a regular video file without DRM or other forms of encryption, and do not require the recipient of the video to have your own application preinstalled, then there is no way to protect the video. If you send it out so that any device can play it, then it can also be redistributed further. There are no magic bits or bytes to change that would make it secure.

    You need to use DRM and related license/key delivery mechanisms to make it reasonably secure, or you need to also have the recipient first install your own video player which then would be the only application capable of handling your encrypted video file (and even that can be hacked).

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Re: How i can encrypt a file like a video ?

    Hi everyone.

    This code protects a file.
    I change some bytes of the 3gp video.

    Greetings.

    Code:
    public static void abrirFile(boolean corruptFile)
    	{
    		Connection ci =null;
    		Connection co =null;
    
    		FileConnection fileIn=null;
    		FileConnection fileOut=null;
    	
    		InputStream is=null;
    		OutputStream os=null;
    		
    		try
    		{
    			ci = Connector.open("file:///E:/video/original.3gp");
    			if(corruptFile)
    			{
    				co = Connector.open("file:///E:/video/protected.3gp",Connector.READ_WRITE);
    			}
    			else
    			{
    				co = Connector.open("file:///E:/video/unprotected.3gp",Connector.READ_WRITE);
    			}
    
    			if(ci!=null)
    			{
    				fileIn = (FileConnection)ci;
    				fileIn.setWritable(false);
    				is = fileIn.openInputStream();
    		
    				fileOut = (FileConnection)co;
    				
    				if(!fileOut.exists())
    				{
    					fileOut.create();
    				}
    				else
    				{
    					fileOut.truncate(0);
    				}
    				
    				os= fileOut.openOutputStream();
    				
    				
    				byte []c=new byte[2000];
    				int count=0;
    
    				boolean first = true; 
    				// first read/write cycle. for modify only the first bytes !
    				while ((is.read(c, count, c.length)) != -1) 
    				{
    					if(first)
    					{
    						if(corruptFile==true) // if i want to make the file unusable.
    						{
    							c[0]=0x0;
    							c[1]=0x0;
    							c[2]=0x0;
    							c[3]=0x0;
    							c[4]=0x0;
    							c[5]=0x0;
    							c[6]=0x0;
    							c[7]=0x0;
    							c[8]=0x0;
    							c[9]=0x0;								
    						}
    						else
    						{
    							// if i want to fix the file, or do nothing.
    							// (these are the correct bytes)
    							c[0]=0x0;
    							c[1]=0x0;
    							c[2]=0x0;
    							c[3]=0x14;
    							c[4]=0x66;
    							c[5]=0x74;
    							c[6]=0x79;
    							c[7]=0x70;
    							c[8]=0x33;
    							c[9]=0x67;
    						}
    						os.write(c);
    						first = false;
    					}
    					else
    					{
    						// normal write/copy
    						os.write(c);
    					}
    		        }
    				os.flush();
    			}
    		}
    		catch (Exception e) 
    		{
    			debug(""+e);
    			
    			e.printStackTrace();
    			
    		}
    		
    		// close is,os, etc...
    		try 
    		{
    			is.close();
    			os.close();
    			
    			fileIn.close();
    			fileOut.close();
    			
    			ci.close();
    			co.close();
    		}
    		catch (Exception e) 
    		{}
    	}

Similar Threads

  1. Error : Cannot find file : for DUMMIES
    By PACALA_BA in forum Symbian
    Replies: 7
    Last Post: 2008-07-06, 13:18
  2. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Symbian
    Replies: 35
    Last Post: 2008-01-17, 09:12
  3. Playing 3GP video file in local file system.
    By media999 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2006-09-14, 07:53
  4. S60 theme questions
    By Nokian_Spb in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-17, 06:11
  5. Unable To Play a Video File In symbian 9.1 device
    By mailkamlesh in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-14, 18:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×