Android编程加密算法小结(AES、Base64、RAS加密算法)

时间:2021-05-20

本文实例总结了Android编程加密算法。分享给大家供大家参考,具体如下:

android常用加密算法之Base64加密算法:

package com.long;/** * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://".getBytes(); //加密 cipher.init(Cipher.ENCRYPT_MODE, publicKey); byte[] enBytes = cipher.doFinal(plainText); //通过密钥字符串得到密钥 publicKey = getPublicKey(publicKeyString); privateKey = getPrivateKey(privateKeyString); //解密 cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[]deBytes = cipher.doFinal(enBytes); publicKeyString = getKeyString(publicKey); System.out.println("public:\n" +publicKeyString); privateKeyString = getKeyString(privateKey); System.out.println("private:\n" + privateKeyString); String s = new String(deBytes); System.out.println(s); } }

希望本文所述对大家Android程序设计有所帮助。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章