B4J Library Alice - AES Encryption

Discussion in 'B4J Libraries & Classes' started by DonManfred, Aug 5, 2019.

  1. DonManfred

    DonManfred Expert Licensed User

    This is a wrap for this Github Project.

    Java AES encryption library

    Alice is a Java AES/DES encryption library for working with byte arrays, files, and streams. Various key lengths, block modes, padding schemes, key deriviation functions, and Message Authentication Codes (MAC) are available. See the javadoc for more information.


    Alice
    <link>Aliceproject on Github|https://github.com/rockaport/alice</link>
    Author: DonManfred
    Version: 0.07
    • Alice
      • Events:
        • Decrypt (success As Boolean, path As String, Filename As String)
        • Encrypt (success As Boolean, path As String, Filename As String)
      • Functions:
        • decryptBytes (encrypted As Byte(), password As String) As Byte()
        • decryptFile (sourcePath As String, sourceFilename As String, destPath As String, destFilename As String, password As String)
        • decryptFile2 (sourcePath As String, sourceFilename As String, destPath As String, destFilename As String, password As String)
        • decryptStream (input As java.io.InputStream, output As java.io_OutputStream, password As Char())
        • encryptBytes (input As Byte(), password As Char()) As Byte()
        • encryptFile (sourcePath As String, sourceFilename As String, destPath As String, destFilename As String, password As String)
        • encryptFile2 (sourcePath As String, sourceFilename As String, destPath As String, destFilename As String, password As String)
        • encryptStream (input As java.io.InputStream, output As java.io_OutputStream, password As Char())
        • generateKey (algorithm As String, keyLength As String) As Byte()
          algorithm can be either AES, DES or DESede
          keyLength can be either BITS_64, BITS_128, BITS_192 pr BITS_256
        • generateKey2 (algorithm As String, keyLength As String) As Byte()
        • Initialize (EventName As String, context As com.rockaport.alice.AliceContext)
    • AliceConstants
      • Fields:
        • AES As com.rockaport.alice.AliceContext.Algorithm
        • CBC As com.rockaport.alice.AliceContext.Mode
        • CTR As com.rockaport.alice.AliceContext.Mode
        • DES As com.rockaport.alice.AliceContext.Algorithm
        • DESede As com.rockaport.alice.AliceContext.Algorithm
        • GCM As com.rockaport.alice.AliceContext.Mode
        • GcmTagLengthBITS_104 As com.rockaport.alice.AliceContext.GcmTagLength
        • GcmTagLengthBITS_112 As com.rockaport.alice.AliceContext.GcmTagLength
        • GcmTagLengthBITS_120 As com.rockaport.alice.AliceContext.GcmTagLength
        • GcmTagLengthBITS_128 As com.rockaport.alice.AliceContext.GcmTagLength
        • GcmTagLengthBITS_96 As com.rockaport.alice.AliceContext.GcmTagLength
        • HMAC_SHA_1 As com.rockaport.alice.AliceContext.MacAlgorithm
        • HMAC_SHA_256 As com.rockaport.alice.AliceContext.MacAlgorithm
        • HMAC_SHA_384 As com.rockaport.alice.AliceContext.MacAlgorithm
        • HMAC_SHA_512 As com.rockaport.alice.AliceContext.MacAlgorithm
        • KeyLengthBITS_128 As com.rockaport.alice.AliceContext.KeyLength
        • KeyLengthBITS_192 As com.rockaport.alice.AliceContext.KeyLength
        • KeyLengthBITS_256 As com.rockaport.alice.AliceContext.KeyLength
        • KeyLengthBITS_64 As com.rockaport.alice.AliceContext.KeyLength
        • MacAlgorithmNONE As com.rockaport.alice.AliceContext.MacAlgorithm
        • PaddingNO_PADDING As com.rockaport.alice.AliceContext.Padding
        • PaddingPKCS5_PADDING As com.rockaport.alice.AliceContext.Padding
        • PBKDF_2_WITH_HMAC_SHA_1 As com.rockaport.alice.AliceContext.Pbkdf
        • PBKDF_2_WITH_HMAC_SHA_256 As com.rockaport.alice.AliceContext.Pbkdf
        • PBKDF_2_WITH_HMAC_SHA_384 As com.rockaport.alice.AliceContext.Pbkdf
        • PBKDF_2_WITH_HMAC_SHA_512 As com.rockaport.alice.AliceContext.Pbkdf
        • PbkdfNONE As com.rockaport.alice.AliceContext.Pbkdf
        • SHA_1 As com.rockaport.alice.AliceContext.Pbkdf
        • SHA_224 As com.rockaport.alice.AliceContext.Pbkdf
        • SHA_256 As com.rockaport.alice.AliceContext.Pbkdf
        • SHA_384 As com.rockaport.alice.AliceContext.Pbkdf
        • SHA_512 As com.rockaport.alice.AliceContext.Pbkdf
    • AliceContextBuilder
      • Functions:
        • build As com.rockaport.alice.AliceContext
        • Initialize (EventName As String)
        • IsInitialized As Boolean
      • Properties:
        • Algorithm As String [write only]
        • GcmTagLength As String [write only]
        • Iterations As Int [write only]
        • IvLength As Int [write only]
        • KeyLength As String [write only]
        • MacAlgorithm As String [write only]
        • Mode As String [write only]
        • Padding As String [write only]
        • Pbkdf As String [write only]

    A B4A Version is also available.

    I tested it with a file of 2.4GB Size
     

    Attached Files:

    jmon, Jorge M A, Erel and 5 others like this.
  2. Chris Tyrie

    Chris Tyrie Member Licensed User

    Any chance of wrapping a non-NSA designed algo? Snowden showed these are not safe to use.
     
  3. DonManfred

    DonManfred Expert Licensed User

    I just did a wrap for the Alice Github Project. I did not developed anything here. Just made a Githubproject useable in B4A and B4J.

    If you know a Githubproject which is doing what you want: Post the url: i´ll see what i can do. Note that it should be compatible with b4a and b4j too.
     
    Last edited: Aug 13, 2019
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice