KapiteinOllie
Member
Hello, i experiencing some problems with encrypting/decrypting files with simplepgp.
Maybe i am doing something wrong or misunderstood the example.
But files with size 2Mb and bigger the simplepgp eats some bytes during encryption/decryption at the end of the file and makes the file corrupt.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Can anybody confirm? Or is it just a me problem?
			
			Maybe i am doing something wrong or misunderstood the example.
But files with size 2Mb and bigger the simplepgp eats some bytes during encryption/decryption at the end of the file and makes the file corrupt.
			
				pgp code:
			
		
		
		    Dim password As String = RandomString(64)
    Dim pubkey As OutputStream = File.OpenOutput(File.DirData("temp"),"publickey.pem",False)
    Dim seckey As OutputStream = File.OpenOutput(File.DirData("temp"),"secretkey.pem",False)
    pgpkeys.Initialize("")
    pgpkeys.generateKeyPair2("pgp",password,1024,pubkey,seckey)
    
    Dim crypt As PGPMessageEncryptor
    crypt.Initialize("crypt")
    Dim data As InputStream = File.OpenInput(File.DirData("temp"),"file.mp4")
    Dim publickey As InputStream = File.OpenInput(File.DirData("temp"),"publickey.pem")
    Dim out_data As OutputStream = File.OpenOutput(File.DirData("temp"),"file.pgp",False)
    crypt.encrypt(publickey,"", data, out_data)
    
    Dim input_data As InputStream = File.OpenInput(File.DirData("temp"),"file.pgp")
    Dim secretkey As InputStream = File.OpenInput(File.DirData("temp"),"secretkey.pem")
    Dim decrypted_data As OutputStream = File.OpenOutput(File.DirData("temp"),"testfile.mp4",False)
    crypt.decrypt(password,secretkey,input_data,decrypted_data)
	Can anybody confirm? Or is it just a me problem?