Code Monkey home page Code Monkey logo

Comments (3)

alokomkar avatar alokomkar commented on September 28, 2024

I tried modifying the way image is saved.

Save picture using AsyncTask

  • not much success.
fun decryptFile( inputFile : File ) : File {

    val size = inputFile.length().toInt()
    val fileBytes = ByteArray(size)
    val aeS256JNCryptor = AES256JNCryptor()
    val file = File(Environment.getExternalStorageDirectory().toString() + "/Decrypted_" + inputFile.name)
    try {
        val buf = BufferedInputStream(FileInputStream(inputFile))
        buf.read(fileBytes, 0, fileBytes.size)

        val decryptedFileBytes = aeS256JNCryptor.decryptData(fileBytes, "master".toCharArray())

        if( file.exists() ) file.delete()

        //val bufOut = BufferedOutputStream(file.outputStream())
        //bufOut.write(decryptedFileBytes)

        val fileOutputStream = FileOutputStream( file.absolutePath )
        fileOutputStream.write(decryptedFileBytes)
        buf.close()
        fileOutputStream.close()
        //bufOut.close()

    } catch (e: FileNotFoundException) {
        // TODO Auto-generated catch block
        e.printStackTrace()
    } catch (e: IOException) {
        // TODO Auto-generated catch block
        e.printStackTrace()
    }

    return file
}

As well as Bitmap decode :

val fileOutputStream = FileOutputStream( file.absolutePath )
        //fileOutputStream.write(decryptedFileBytes)

        val bitmap = BitmapFactory.decodeByteArray(decryptedFileBytes, 0, decryptedFileBytes.size)
        if( bitmap != null )
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream)


        buf.close()
        fileOutputStream.close()

@dmjones500

from jncryptor.

dmjones avatar dmjones commented on September 28, 2024

I'm not familiar with the platform you're using (which I assume is Kotlin, based on your stackoverflow question).

I think you're best to seek support through stack overflow, so I'll close this issue here. Please re-open (or open a new one) if a bug is found within this library.

from jncryptor.

alokomkar avatar alokomkar commented on September 28, 2024

@dmjones500 Yes, I have opened the question in Stack overflow too. I can convert the code into Java and post it in SO Post, Would it help?

from jncryptor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.