Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Use OpenSSL carried BASE64 encoding and decoding     - Snort build a secure Linux server (Linux)

- Vim copy and paste register (Linux)

- Linux command Detailed chpasswd bulk edit user password (Linux)

- Using IPFilter bridge filter in the FreeBSD system (Linux)

- Linux automatically install service components and optimize the kernel parameters (Linux)

- Xmanager Remote Desktop login CentOS 6.5 (Linux)

- Ansible installation configuration and simple to use (Server)

- Linux iptables firewall settings (Linux)

- There is sort of a directed acyclic graph topology (Programming)

- Oracle Database High-Risk Vulnerability Warning (Database)

- grub boot error resolution examples (Linux)

- ORA-00824: can not set sga_target due to existing problem-solving (Database)

- Getting Started with Linux system to learn: how to configure a static IP address for CentOS7 (Linux)

- Asynchronous JavaScript loading (Programming)

- wget command Walkthrough (Linux)

- MongoDB query timeout exception SocketTimeoutException (Database)

- Check the Linux server performance with ten or so commands in a minute (Server)

- pscp use Detailed Windows and Linux each file transfer tool (Linux)

- WinSCP to transfer text files will automatically convert the format (Linux)

- Ubuntu Apache virtual host configuration (Server)

 
         
  Use OpenSSL carried BASE64 encoding and decoding
     
  Add Date : 2017-08-31      
         
       
         
  OpenSSL can use the command file members were base64 encoding and decoding using the API OpenSSL to provide the same can do it.

Ado, directly on the code. Note that the character base64 encoded by each of 64 bytes, there will be a newline exists.

static int base64_encode (char * str, int str_len, char * encode, int encode_len) {
    BIO * bmem, * b64;
    BUF_MEM * bptr;
    b64 = BIO_new (BIO_f_base64 ());
    bmem = BIO_new (BIO_s_mem ());
    b64 = BIO_push (b64, bmem);
    BIO_write (b64, str, str_len); // encode
    BIO_flush (b64);
    BIO_get_mem_ptr (b64, & bptr);
    if (bptr-> length> encode_len) {
        DPRINTF ( "encode_len too small \ n");
        return -1;
    }
    encode_len = bptr-> length;
    memcpy (encode, bptr-> data, bptr-> length);
// Write (1, encode, bptr-> length);
    BIO_free_all (b64);
    return encode_len;
}

static int base64_decode (char * str, int str_len, char * decode, int decode_buffer_len) {
    int len = 0;
    BIO * b64, * bmem;
    b64 = BIO_new (BIO_f_base64 ());
    bmem = BIO_new_mem_buf (str, str_len);
    bmem = BIO_push (b64, bmem);
    len = BIO_read (bmem, decode, str_len);
    decode [len] = 0;
    BIO_free_all (bmem);
    return 0;
}
     
         
       
         
  More:      
 
- SQL in the specific internal Oracle process (Database)
- OpenDaylight Helium version installed (Linux)
- How to use jgit to manage Git submodule (Linux)
- Linux system security check notes on performance (Linux)
- How to install and configure the KVM and Open vSwitch on Linux distributions (Linux)
- Learning C language pointer essays (Programming)
- Linux some lessons learned about network security (Linux)
- Java MVC CRUD examples (Programming)
- Java Virtual Machine Basics (Programming)
- Linux SSH remote connection service slow Solutions (Linux)
- How to manage KVM virtual environments with command-line tools in Linux (Server)
- RHEL7 unattended automatic installation DHCP + TFTP + SYSLINUX + TFTP + Kickstart (Linux)
- A key installation Gitlab 7 on RHEL6.4 and Setup Mail TX (Linux)
- Generate two-dimensional code parsing code Java (Programming)
- SSH without password Definitive Guide (Linux)
- Additional SQL Server 5123 database reported error (Database)
- RHEL6 install Python and other packages from source (Linux)
- Merge sort Java implementation (Programming)
- Android Custom View password box example (Programming)
- Hadoop scheduling availability of workflow platform - Oozie (Server)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.