zoukankan      html  css  js  c++  java
  • ABAP 加密解密程序

    用于对字符串的加密和解密:
     

    DATA: o_encryptor        TYPE REF TO cl_hard_wired_encryptor,
         o_cx_encrypt_error TYPE REF TO cx_encrypt_error.
    DATA: v_ac_string  TYPE string VALUE 'RICK',
          v_ac_xstring TYPE xstring,
          v_en_string  TYPE string,
          v_en_xstring TYPE xstring,
          v_de_string  TYPE string,
          v_de_xstring TYPE string,
          v_error_msg  TYPE string.
    
    START-OF-SELECTION.
    * Create object for Encryption
      CREATE OBJECT o_encryptor.
    * *&---------------------------------------------------------------------*
    * Encryption - String to String
    *&---------------------------------------------------------------------*
      WRITE / 'Encryption - String to String'.
      TRY.
          CALL METHOD o_encryptor->encrypt_string2string
            EXPORTING
              the_string = v_ac_string
            RECEIVING
              result     = v_en_string.
        CATCH cx_encrypt_error INTO o_cx_encrypt_error.
          CALL METHOD o_cx_encrypt_error->if_message~get_text
            RECEIVING
              result = v_error_msg.
          MESSAGE v_error_msg TYPE 'E'.
      ENDTRY.
      WRITE:/ 'Actual String: ', v_ac_string.
      WRITE:/ 'Encrypted String: ', v_en_string.
      SKIP.
    *   *&---------------------------------------------------------------------*
    * Decryption - String to String
    *&---------------------------------------------------------------------*
      WRITE / 'Decryption - String to String'.
      TRY.
          CALL METHOD o_encryptor->decrypt_string2string
            EXPORTING
              the_string = v_en_string
            RECEIVING
              result     = v_de_string.
        CATCH cx_encrypt_error INTO o_cx_encrypt_error.
          CALL METHOD o_cx_encrypt_error->if_message~get_text
            RECEIVING
              result = v_error_msg.
          MESSAGE v_error_msg TYPE 'E'.
      ENDTRY.
      WRITE:/ 'Encrypted String: ', v_en_string.
      WRITE:/ 'Decrypted String: ', v_de_string.
      SKIP.

  • 相关阅读:
    centos安装docker
    centos 安装nginx遇到的问题
    IntelliJ IDEA 2018.3 永久激活 破解[Windows]
    mysql 8.0.12重置密码
    mysql8.*忘记密码
    CentOS安装Hadoop
    执行 systemctl start firewalld 命令后出现Failed to start firewalld.service: Unit is masked
    Centos操作命令
    解决CentOS7关闭/开启防火墙出现Unit iptables.service failed to load: No such file or directory.
    Java并发Lock接口
  • 原文地址:https://www.cnblogs.com/ruingy/p/Rick.html
Copyright © 2011-2022 走看看