信息安全技术在Android平台下的实现

来源:互联网 发布:linux重置root密码忘记 编辑:程序博客网 时间:2024/06/07 02:08

首先,我们    说起信息安全,大家都有自己的看法,今天我们就来实现一下密码编码学中简单加解密码的实现,当然主要因素是给女朋友要传递传递别人看不懂的信息可怜。
    现在,我们就说一说实现步骤的具体规划,首先,我们需要确定编程使用的语言和环境,初步计划使用Android的编程环境,编写一款便于手机上使用的小软件,这样的话我就可以轻松的将信息发给对方。
   具体的工作:第一步需设计一个选择界面,用来实现各种不同的加密方式,第二步需要对各种加解密方式进行代码部署,第三步进行测试。
  一、主界面的设计

      打开eclipse,选择“File->new->Android Applicantion Project”,然后弹出“New Project Applicantion”界面,此时我们可以对工程进行命名,在这里我们填写工程名为“Cryptography”,更改包名为"com.suguniang.cryptography",然后点击右下角的按钮“Next->Next”,接着弹出图标界面设计对话框,选择自己准备好的图标,然后点击"Next->Next->Finish",创建完成项目之后,会弹出到layout界面上,我们就可以进行代码编写:在左边的树状关系菜单中,右键点击“layout”,创建一个新的XML文件,即“layout->New->Android Xml File”,然后会弹出一个“New Anroid Xml File”对话框,在第三个文本框中输入新建XML文件的名称,在这里我们输入"opt_first",然后点击"Finish"完成创建,接着我们就开始编写代码:

   其中opt_first的代码如下:

  

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="fill_parent"    android:background="@drawable/ljo"    android:alpha="0.7"    android:gravity="fill_horizontal"    android:orientation="vertical"    ><RelativeLayout    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:background="@drawable/nbf">        <ImageView        android:id="@+id/iv_top"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:src="@drawable/ie_arrow_normal"        android:onClick="finish_reback"        android:layout_marginLeft="0dp"         />    <TextView            android:id="@+id/tv_top"        android:layout_width="wrap_content"        android:layout_height="wrap_content"       android:text="加密方式选择"       android:layout_centerHorizontal="true"    android:layout_centerVertical="true"       android:textColor="@android:color/holo_red_light"/>    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerVertical="true"        android:layout_toRightOf="@+id/iv_top"        android:text="返回"        android:textSize="20sp" /></RelativeLayout>    <ExpandableListView        android:id="@+id/el_option"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_marginBottom="5dp"        android:layout_marginLeft="5dp"        android:layout_marginRight="5dp"        android:layout_marginTop="0dp"        android:alpha="0.8"        android:background="@drawable/beijingnihao" >    </ExpandableListView>    </LinearLayout>
对于各种类的代码由于过于繁多,就不一一粘贴,如有需要的请私我。

二、测试

  1、opt_first实现的界面如下所示:,其中有多种加密方式(实现的只有很少几种。。。)

   



2、进入代替加密技术进行加密

           我们输入汉字,来自于网络的一段文字,然后点击加密,就能够转化为编码

   


3、在点击加密之后,能够看到加密的信息

   如下图所示:



4、接着点击解密,就能够将信息还原



在这个小程序中,主要使用的是代替技术,即将很多字符进行代替以实现加密,当然还有几种其他的加密方式,有兴趣的可以交流。。。谢谢

1 0
原创粉丝点击