Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Use OpenSSL carried BASE64 encoding and decoding     - Under CentOS using yum command to install the Task Scheduler crontab (Linux)

- Broadcom transplanted to OpenWrt summary (Programming)

- Linux common network tools: traceroute routing of scanned (Linux)

- Oracle 11g + RAC + RHEL6.5 + udev + ASM + PSU installation summary (Database)

- CentOS 6/7 Series Docker Installation (Linux)

- 64-bit Oracle Linux recompiled Hadoop-2.2.0 (Server)

- How to install and configure a VNC server on CentOS 7.0 (Server)

- How to set up HTTPS policies for older browsers (Server)

- Linux system file directory structure Introduction (Linux)

- Grub2: Save Your bootloader (Linux)

- Create a custom pixel format based on an existing image data BufferedImage (Programming)

- Shell Programming Regular Expressions (Programming)

- Installation configuration CUDA under Ubuntu 14.04 (Linux)

- Minimum period string problem (Programming)

- Install and configure GO 1.2.1 under CentOS 6.5 (Linux)

- Let your PHP 7 faster (GCC PGO) (Linux)

- Ubuntu 14.04 Nvidia graphics driver installation and settings (Linux)

- Tomcat installation under Linux (Server)

- Linux serial debugging tools xgcom install (Linux)

- How to clear the v $ archived_log view expiration information (Database)

 
         
  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:      
 
- Based shell: using read, the command-line script to achieve mass participation and input two integer calculation (Programming)
- SecureCRT in Python scripting study guide (Programming)
- Oracle delete table space prompted ORA-00604 and ORA-38301 (Database)
- grep, egrep and regular expressions (Linux)
- MongoDB Study Notes (1) - Install MongoDB on Windows systems (Database)
- Oracle 11G R2 DataGuard structures (Database)
- 10 easy to use Linux utilities Recommended (Linux)
- Linux can modify the maximum number of open files (Linux)
- Linux system ARP attack solution (Linux)
- To install Google Chrome browser under Ubuntu 14.04 LTS (Linux)
- Linux / CentOS 7.0 installation and configuration under Tomcat 8.0 (Server)
- Oracle DATABASE LINK (DBLINK) Create (Database)
- Oracle 11g contraction table space error ORA-03297: file contains used data beyondrequested RESIZE value (Database)
- Partition contrast manifestations under Windows and Linux (Linux)
- MySQL Parameter Tuning Best Practices (Database)
- The difference between free command displays the buffers and cache (Linux)
- Learning how to teach safety system to prevent your own IP leakage (Linux)
- HBase in MVCC implementation mechanism and its application (Database)
- About phpwind 5.01-5.3 0day analysis of the article (Linux)
- MySQL 5.7.9 source compiler installation instructions (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.