RAS非对称加解密-RAS加解密和签名和验签,密钥生成器(java代码)
RAS非对称加解密-RAS加解密和签名和验签,密钥生成器(java代码)
RSA 算法是一种非对称加解密算法。服务方生成一对 RSA 密钥,即公钥 + 私钥,将公钥提供给调用方,调用方使用公钥对数据进行加密后,服务方根据私钥进行解密。
1. RAS密钥生成器
2. RAS加解密和签名和验签 代码1
3. RAS实现签名和验签 代码2
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey; /**
* 密钥生成器
*/
public class RSAKeysGenerator {
/**
* RsaKey 密钥生成器
*
* @return stirng[0]-pubKey string[1]-privKey
* @throws Exception
* @author guolei
*/
public static String[] generateRsaKeys() throws Exception {
String[] keys = new String[2];
String pubKeyStr = "", priKeyStr = "";
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(1024);// 1024 bit
KeyPair pair = generator.generateKeyPair();
PublicKey pubKey = pair.getPublic();
PrivateKey privKey = pair.getPrivate();
pubKeyStr = Base64.encode(pubKey.getEncoded()).replaceAll(" ", "");
priKeyStr = Base64.encode(privKey.getEncoded()).replaceAll(" ", ""); keys[0] = pubKeyStr; // public Key
keys[1] = priKeyStr; // private key return keys;
}
public static void main(String[] args) {
try {
String[] keys = generateRsaKeys();
System.out.println("Public Key::" + keys[0]);
System.out.println("Private Key::" + keys[1]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
2. RAS加解密和签名和验签 代码1
import javax.crypto.Cipher;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.RSAPublicKeySpec;
import java.security.spec.X509EncodedKeySpec; public class RSA { public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; /**
* RSA签名
* @param content 待签名数据
* @param privateKey 商户私钥
* @param input_charset 编码格式
* @return 签名值
*/
public static String sign(String content, String privateKey, String input_charset)
{
try
{
PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( Base64.decode(privateKey) );
KeyFactory keyf = KeyFactory.getInstance("RSA");
PrivateKey priKey = keyf.generatePrivate(priPKCS8); java.security.Signature signature = java.security.Signature
.getInstance(SIGN_ALGORITHMS); signature.initSign(priKey);
signature.update( content.getBytes(input_charset) ); byte[] signed = signature.sign(); return Base64.encode(signed);
}
catch (Exception e)
{
e.printStackTrace();
} return null;
} /**
* RSA验签名检查
* @param content 待签名数据
* @param sign 签名值
* @param ali_public_key 支付宝公钥
* @param input_charset 编码格式
* @return 布尔值
*/
public static boolean verify(String content, String sign, String ali_public_key, String input_charset)
{
try
{
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
byte[] encodedKey = Base64.decode(ali_public_key);
PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); java.security.Signature signature = java.security.Signature
.getInstance(SIGN_ALGORITHMS); signature.initVerify(pubKey);
signature.update( content.getBytes(input_charset) ); boolean bverify = signature.verify( Base64.decode(sign) );
return bverify; }
catch (Exception e)
{
e.printStackTrace();
} return false;
} /**
* 私钥解密
* @param content 密文
* @param private_key 商户私钥
* @param input_charset 编码格式
* @return 解密后的字符串
*/
public static String decrypt(String content, String private_key, String input_charset) throws Exception {
PrivateKey prikey = getPrivateKey(private_key); Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, prikey); InputStream ins = new ByteArrayInputStream(Base64.decode(content));
ByteArrayOutputStream writer = new ByteArrayOutputStream();
//rsa解密的字节大小最多是128,将需要解密的内容,按128位拆开解密
byte[] buf = new byte[128];
int bufl; while ((bufl = ins.read(buf)) != -1) {
byte[] block = null; if (buf.length == bufl) {
block = buf;
} else {
block = new byte[bufl];
for (int i = 0; i < bufl; i++) {
block[i] = buf[i];
}
} writer.write(cipher.doFinal(block));
} return new String(writer.toByteArray(), input_charset);
} /**
* 私钥解密
*
* @param secretText 待解密的密文字符串
* @param privateKeyStr 私钥
* @return 解密后的明文
*/
public static String decrypt1(String secretText, String privateKeyStr,String input_charset) {
try {
// 生成私钥
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, getPrivateKey(privateKeyStr));
// 密文解码
byte[] secretTextDecoded = Base64.decode(secretText);
byte[] tempBytes = cipher.doFinal(secretTextDecoded);
return new String(tempBytes);
} catch (Exception e) {
throw new RuntimeException("解密字符串[" + secretText + "]时遇到异常", e);
}
} /**
* 公钥 加密
* @param content
* @param
* @param input_charset
* @return
* @throws Exception
*/
public static String encrypt(String content, String public_key, String input_charset) throws Exception { PublicKey pubkey = getPublicKey(public_key); Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubkey);
byte[] tempBytes = cipher.doFinal(content.getBytes("UTF-8"));
return Base64.encode(tempBytes);
// return new String(tempBytes, input_charset);
} /**
* 得到私钥
* @param key 密钥字符串(经过base64编码)
* @throws Exception
*/
private static PrivateKey getPrivateKey(String key) throws Exception { byte[] keyBytes; keyBytes = Base64.decode(key); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PrivateKey privateKey = keyFactory.generatePrivate(keySpec); return privateKey;
} /**
* 得到公钥
* @param key
* @return
* @throws Exception
*/
private static PublicKey getPublicKey(String key) throws Exception {
byte[] keyBytes;
keyBytes = Base64.decode(key); //Only RSAPublicKeySpec and X509EncodedKeySpec supported for RSA public keys
// PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PublicKey publicKey = keyFactory.generatePublic(keySpec);
return publicKey;
} /**
* 报文体签名=f6G0o2wme/8uiQFt6/FRd0kO160Mp+NEs9p3JizqHY3SjqYdp28Bk+DJW4heYLrmSIt3PyHrOdKGRppqfdjJt02VXUJyc/A0Xg0KuQ3ulfpmqzxOA4gzNea+CeZtLUjzshXq2WedEgH4QF4LrFkDeaMWefE3YkIOfwcbNrcJJtE=
* verify flag=true
* enctyptString=g0XdRF6wAELkudaOCdolTBhx4mkSX/7LtvbMKd1AZt79H2MSKI7U+fvR4Sb6NL8028LlH9lmmS3Og7BKzNz+yBhvGOiA3NKlIMh1GTBNsfmPwXapFcVDFghbkc/cpWyOLHv263fSHxCN4cVYenQYAxOSQgK2VZ7bMtt8E87eZSg=
* detyptString={amount=250, name=张三, orderId=2014061114360001}
* detyptStringNew={amount=250, name=张三, orderId=2014061114360001}
*
* @param args
*/
public static void main(String[] args) {
String pubKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUDWMv2wCwYlFKJebtYc+E3rji8rnYEeRZGU9t4Y6RFAhJfsCm1yUGAS26PhAsgYTJIptnBESr+RtATxOelh03JwEyFXEYyZyl2VQnbtAftHkkcnLp812z4FyDPRldwVj1AAdFGUEhYW4Hc1sbRJnv41LNJBDio8jiKPGQT9titQIDAQAB";
String priKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJQNYy/bALBiUUol5u1hz4TeuOLyudgR5FkZT23hjpEUCEl+wKbXJQYBLbo+ECyBhMkim2cERKv5G0BPE56WHTcnATIVcRjJnKXZVCdu0B+0eSRycunzXbPgXIM9GV3BWPUAB0UZQSFhbgdzWxtEme/jUs0kEOKjyOIo8ZBP22K1AgMBAAECgYBMmIiCT7mRh6wqwmUw1vO3+EqLD6zafpc3CYMwhAtwP37yFyOwrYo4CxAPVOClRfTe4oqnx2uH1X8lzEOIPn2qJFU1AQdiC9XmvLkqeoa1jXH2rwDwxbs8VYE/1wEzFa/u7dAYu+0lnokgPx03cdZEA5AiQq26fQ0yFoipCHJhAQJBAP5MOI5G1FsXhIXZWFup+7ZkoHVuqoHxafV5I7RVEXmRdVBHEzbY7Rf7QMWGfS7rEGnLuEKjWNMHgUDZHEkJZ5UCQQCVCxkpcrJW7u+BLL61Rl1X4wuN0Z4HKQPj/YhGD0lnkssKUPW9GCy1dQUp00yvRfCwz0s4rdfGGMWlA1xqhMahAkEAgn3eb7QM+ImC6aR0YOVDU38jj98wA+o780ksdzdH9lgcGQu/4l9CmxHFVRcEWfUpwQBXF2r3A6NQQlSm3RvEWQJAJD3OoIWDWCBBnOeEeA/kIrrS1GlkQ9l1WLsNp/uPnd/T/24wUwrN1FHgL4tx2iznmhbN87pR/ZmIddebYUtoAQJAfAPoHMSLPCqZgVFTo/uQU3Zq2GbGmo1B7cLrnBu62DsUlqoVk31dVLC9inKuRwOsXlp8s3gmadiJlMZJUwf+xQ=="; String content ="{amount=250, name=张三, orderId=2014061114360001}"; //rsa签名和验证签名 //私钥加密 生成报文体和报文体签名
String signData = sign(content,priKey,"UTF-8");
System.out.println("报文体签名="+signData); //公钥验证签名
boolean f = verify(content,signData,pubKey,"UTF-8");
System.out.println("verify flag="+f); try {
String enctyptString = encrypt(content,pubKey,"UTF-8");
System.out.println("enctyptString="+enctyptString); //解密的方法1
String detyptString = decrypt(enctyptString,priKey,"UTF-8");
System.out.println("detyptString="+detyptString); //decrypt1 解密的方法2
String detyptStringNew = decrypt1(enctyptString,priKey,"UTF-8");
System.out.println("detyptStringNew="+detyptStringNew);
} catch (Exception e) {
e.printStackTrace();
}
}
}
3. RAS实现签名和验签 代码2
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.KeyFactory;
import java.security.Signature;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec; /**
* 签名以及验签
*/
public class RSAUtil { private static final Logger logger = LoggerFactory.getLogger(RSAUtil.class); /** RSA:加密算法 */
private static final String KEY_ALGORITHM = "RSA"; /** SHA1WithRSA:用SHA算法进行签名,用RSA算法进行加密 */
private static final String SIGN_ALGORITHMS = "SHA1withRSA"; /**
* 生成报文体和报文体签名
*
* @param privateKey
* @param content
* @param encoding
* @return
*/
public static String[] signData(String privateKey, String content, String encoding) {
logger.info("原始报文内容:" + content);
String param[] = new String[2];
try {
// 报文体使用base64编码
content = Base64.encode(content.getBytes(encoding));
// 删除base64编码中的空格
content = content.replaceAll(" ", "");
// 生成报文体签名
String contentSign = envolopData(privateKey, content);
// 报文体签名进行url编码
contentSign = URLEncoder.encode(contentSign, encoding);
logger.info("报文体签名:" + contentSign);
// 报文体进行url编码
content = URLEncoder.encode(content, encoding);
logger.info("base64编码报文体:" + content);
// 返回报文体签名
param[0] = contentSign;
// 返回报文体
param[1] = content;
} catch (Exception e) {
e.printStackTrace();
}
return param;
} /**
* 生成报文体签名
*
* @param privateKey
* @param content
* @return
*/
private static String envolopData(String privateKey, String content) {
// 报文体签名
String contentSign = "";
try {
// 根据密钥字符创建密钥类
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64.decode(privateKey));
KeyFactory fac = KeyFactory.getInstance(KEY_ALGORITHM);
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) fac.generatePrivate(keySpec);
// 创建签名算法类
Signature sigEng = Signature.getInstance(SIGN_ALGORITHMS);
sigEng.initSign(rsaPrivateKey);
// 生成签名
sigEng.update(content.getBytes("UTF-8"));
byte[] signature = sigEng.sign();
// base64编码[请求报文签名]
contentSign = Base64.encode(signature);
// 删除换行符[请求报文签名]
contentSign = contentSign.replaceAll(" ", "");
} catch (Exception e) {
e.printStackTrace();
}
return contentSign;
} /**
* 验证返回的报文的签名
* @param publicKey 公钥
* @param sign 返回报文体的签名
* @param src 返回报文体
* @param encoding 编码格式
* @return
*/
public static boolean rsaVerify(String publicKey, String sign, String src, String encoding) {
// 验签结果
boolean result = false;
try {
// url解密[返回报文签名]
sign = URLDecoder.decode(sign, encoding);
// base64解密[返回报文签名]
byte[] signature = Base64.decode(sign);
// url解密[返回报文]
src = URLDecoder.decode(src, encoding);
// 根据密钥创建密钥类
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(Base64.decode(publicKey));
KeyFactory fac = KeyFactory.getInstance(KEY_ALGORITHM);
RSAPublicKey rsaPubKey = (RSAPublicKey) fac.generatePublic(keySpec);
// 创建签名方法类
Signature sigEng = Signature.getInstance(SIGN_ALGORITHMS);
sigEng.initVerify(rsaPubKey);
// 生成签名
sigEng.update(src.getBytes(encoding));
// 验证签名是一致
result = sigEng.verify(signature);
} catch (Exception e) {
e.printStackTrace();
}
return result;
} /**
* 解密返回的报文体信息
*
* @param content
* @param encoding
* @return
*/
public static String decodeContent(String content, String encoding){
String result = "";
try {
// 返回报文体的签名执行url解密
result = URLDecoder.decode(content, encoding);
// 返回报文体的签名执行base64解密
result = new String(Base64.decode(result), encoding);
} catch (Exception e) {
e.printStackTrace();
}
return result;
} /**
* 报文体签名=JZqGuYnoNkjre6qsIk5avdfYhkHyXDnxkEaSy9UMygX8cvVn4fvMc8can5rZUSefnI3M6a5RCH2YtHuu3TqVb%2FAIoQ8zNeWXb7OeRWgfbR8KrOGTZdfuZebQwT5Id9HBubLQ4BnnRUoPtgbpVZbHr26RwJMhPg36SYUaHPvA0k0%3D
* base64编码报文体=e2Ftb3VudD0yNTAsIG5hbWU95byg5LiJLCBvcmRlcklkPTIwMTQwNjExMTQzNjAwMDF9
* 解析={amount=250, name=张三, orderId=2014061114360001}
* verify flag=true
*
* 报文体签名=f6G0o2wme/8uiQFt6/FRd0kO160Mp+NEs9p3JizqHY3SjqYdp28Bk+DJW4heYLrmSIt3PyHrOdKGRppqfdjJt02VXUJyc/A0Xg0KuQ3ulfpmqzxOA4gzNea+CeZtLUjzshXq2WedEgH4QF4LrFkDeaMWefE3YkIOfwcbNrcJJtE=
* verify flag=true
*
* 测试类
* @param args
*/
public static void main(String[] args) {
String pubKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUDWMv2wCwYlFKJebtYc+E3rji8rnYEeRZGU9t4Y6RFAhJfsCm1yUGAS26PhAsgYTJIptnBESr+RtATxOelh03JwEyFXEYyZyl2VQnbtAftHkkcnLp812z4FyDPRldwVj1AAdFGUEhYW4Hc1sbRJnv41LNJBDio8jiKPGQT9titQIDAQAB";
String priKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJQNYy/bALBiUUol5u1hz4TeuOLyudgR5FkZT23hjpEUCEl+wKbXJQYBLbo+ECyBhMkim2cERKv5G0BPE56WHTcnATIVcRjJnKXZVCdu0B+0eSRycunzXbPgXIM9GV3BWPUAB0UZQSFhbgdzWxtEme/jUs0kEOKjyOIo8ZBP22K1AgMBAAECgYBMmIiCT7mRh6wqwmUw1vO3+EqLD6zafpc3CYMwhAtwP37yFyOwrYo4CxAPVOClRfTe4oqnx2uH1X8lzEOIPn2qJFU1AQdiC9XmvLkqeoa1jXH2rwDwxbs8VYE/1wEzFa/u7dAYu+0lnokgPx03cdZEA5AiQq26fQ0yFoipCHJhAQJBAP5MOI5G1FsXhIXZWFup+7ZkoHVuqoHxafV5I7RVEXmRdVBHEzbY7Rf7QMWGfS7rEGnLuEKjWNMHgUDZHEkJZ5UCQQCVCxkpcrJW7u+BLL61Rl1X4wuN0Z4HKQPj/YhGD0lnkssKUPW9GCy1dQUp00yvRfCwz0s4rdfGGMWlA1xqhMahAkEAgn3eb7QM+ImC6aR0YOVDU38jj98wA+o780ksdzdH9lgcGQu/4l9CmxHFVRcEWfUpwQBXF2r3A6NQQlSm3RvEWQJAJD3OoIWDWCBBnOeEeA/kIrrS1GlkQ9l1WLsNp/uPnd/T/24wUwrN1FHgL4tx2iznmhbN87pR/ZmIddebYUtoAQJAfAPoHMSLPCqZgVFTo/uQU3Zq2GbGmo1B7cLrnBu62DsUlqoVk31dVLC9inKuRwOsXlp8s3gmadiJlMZJUwf+xQ=="; String content ="{amount=250, name=张三, orderId=2014061114360001}"; //私钥加密 生成报文体和报文体签名
String[] signData = signData(priKey,content,"UTF-8");
System.out.println("报文体签名="+signData[0]);
System.out.println("base64编码报文体="+signData[1]);
//解密返回的报文体信息
System.out.println("解析="+decodeContent(signData[1],"UTF-8")); //公钥验证签名
boolean f = rsaVerify(pubKey,signData[0],signData[1],"UTF-8");
System.out.println("verify flag="+f);
}
}
RAS非对称加解密-RAS加解密和签名和验签,密钥生成器(java代码)的更多相关文章
- 几个例子理解对称加密与非对称加密、公钥与私钥、签名与验签、数字证书、HTTPS加密方式
# 原创,转载请留言联系 为什么会出现这么多加密啊,公钥私钥啊,签名啊这些东西呢?说到底还是保证双方通信的安全性与完整性.例如小明发一封表白邮件给小红,他总不希望给别人看见吧.而各种各样的技术就是为了 ...
- .NET RSA解密、签名、验签
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Sec ...
- RSA签名、验签、加密、解密
最近在做一个项目,与一个支付渠道进行连接进行充值,为了安全,每个接口访问时,都要先登陆(调用登陆接口),拿到一个sessionKey,后续业务接口内容用它来进行3DES加密处理.而登陆需要用到RSA进 ...
- RSA加密、解密、签名、验签的原理及方法
一.RSA加密简介 RSA加密是一种非对称加密.可以在不直接传递密钥的情况下,完成解密.这能够确保信息的安全性,避免了直接传递密钥所造成的被破解的风险.是由一对密钥来进行加解密的过程,分别称为公钥和私 ...
- Java & PHP RSA 互通密钥、签名、验签、加密、解密
RSA加密算法是一种非对称加密算法.在公开密钥加密和电子商业中RSA被广泛使用.RSA是1977年由罗纳德·李维斯特(Ron Rivest).阿迪·萨莫尔(Adi Shamir)和伦纳德·阿德曼(Le ...
- 密码基础知识(2)以RSA为例说明加密、解密、签名、验签
密码基础知识(1)https://www.cnblogs.com/xdyixia/p/11528572.html 一.RSA加密简介 RSA加密是一种非对称加密.是由一对密钥来进行加解密的过程,分别称 ...
- php rsa 加密、解密、签名、验签
由于对接第三方机构使用的是Java版本的rsa加解密方法,所有刚开始在网上搜到很多PHP版本的rsa加解密,但是对接java大多都不适用. 以下php版本是适用于对接java接口,java适用密钥再p ...
- PHP 之用证书对数据进行签名、验签、加密、解密
/** * 对数据进行签名 * $data = 'If you are still new to things, we’ve provided a few walkthroughs to get yo ...
- php中rsa加密及解密和签名及验签
加密的内容长度限制为密钥长度少位,如位的密钥最多加密的内容为个长度. 公钥加密 $public_content=file_get_contents(公钥路径); $public_key=openssl ...
- 使用非对称算法RSA实现加解密和使用签名算法SHA1WithRSA、MD5withRSA生成签名以及验签
不啰嗦,直接上源码 package com.hudai.platform.manager.util; import java.io.ByteArrayOutputStream; import java ...
随机推荐
- 阿里云数据库开源重磅发布:PolarDB三节点高可用的功能特性和关键技术
简介:在3月2日的阿里云开源 PolarDB 企业级架构发布会上,阿里云数据库技术专家孟勃荣 带来了主题为<PolarDB 三节点高可用>的精彩演讲.三节点高可用功能主要为 PolarD ...
- KubeNode:阿里巴巴云原生 容器基础设施运维实践
简介: 目前 KubeNode 已经覆盖了阿里巴巴集团的所有的 ASI 集群,接下来,将随着阿里巴巴集团"统一资源池"的项目,推进 KubeNode 覆盖更大的范围.更多的场景,让 ...
- 鸿蒙HarmonyOS实战-ArkUI事件(触屏事件)
前言 触屏事件是指通过触摸屏幕来进行操作和交互的事件.常见的触屏事件包括点击(tap).双击(double tap).长按(long press).滑动(swipe).拖动(drag)等.触屏事件通常 ...
- 表和数据连接,而不是和表连接(JOIN)
1.连接数据,但是顺序会受影响 在使用JOIN连接临时表或子查询时,无法保证结果的顺序与特定值的顺序完全一致.这是因为在查询过程中,数据库优化器可能会选择不同的执行计划,导致结果的顺序发生变化. SE ...
- 密钥存储在过时的 trusted.gpg 密钥环中(/etc/apt/trusted.gpg)
密钥存储在过时的 trusted.gpg 密钥环中(/etc/apt/trusted.gpg) 问题: 解决: cd /etc/opt sudo cp trusted.gpg trusted.gpg. ...
- 后宫酒店HaremHotel游戏Python游戏作弊方法游戏金币增加方法
额,这个游戏嘛,内容就不说了, 顺便送给大家下载地址:https://store.zhaimaojun.cn/GameDetail/280 这个游戏刚开始起步其实比较困难,因为没钱啊,动不动就要花钱, ...
- windows版 navicat_15.0.18 安装
视频安装地址: https://www.ghpym.com/ghvideo07.html 一.下载安装包 下载地址(百度网盘): 链接:https://pan.baidu.com/s/1MIZfmS5 ...
- Golang 之 casbin(权限管理)
目录 1. 权限管理 官网 编辑器测试 1.1.1. 特征 Casbin的作用 Casbin不执行的操作 1.1.2. 怎么运行的 1.1.3. 安装 1. 示例代码 xormadapter 2. 示 ...
- kubernetes之python调用
安装 sudo pip3 install kubernetes 认证 首先引入SDK支持库.然后将 ~/.kube 的config文件的内容复制到本地目录,保存为文件kubeconfig.yaml,然 ...
- deeplearning4j训练MNIST数据集以及验证
训练模型官方示例 MNIST数据下载地址: http://github.com/myleott/mnist_png/raw/master/mnist_png.tar.gz GitHub示例地址: ht ...