• 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.

  • 相关阅读:
    solr一些错误
    maven聚合工程之找不到符号,类等错误
    图片服务器搭建及上传测试,网络配置问题(errno: 111)
    安装Nginx,make时报错:/usr/bin/ld: cannot find -lfdfsclient或者类似找不到-lxxx
    关于PCA算法的学习
    生物信息及开发常用的Linux命令
    05.课程主页面三个接口开发
    04.增加media文件配置
    3.课程相关5张表设计
    2.增加抽象基类
  • 原文地址:https://www.cnblogs.com/ruingy/p/Rick.html
Copyright © 2020-2023  润新知