yuchenfw / gocrypt Goto Github PK
View Code? Open in Web Editor NEWA general solution for commonly used crypt in golang
License: Apache License 2.0
A general solution for commonly used crypt in golang
License: Apache License 2.0
rsa2算法好像没有实现哦,现在都不用rsa,直接用rsa2啦
panic: runtime error: slice bounds out of range [:-75]
goroutine 1 [running]:
github.com/yuchenfw/gocrypt.UnPaddingPKCS7(...)
/golang/pkg/mod/github.com/yuchenfw/[email protected]/handle.go:127
github.com/yuchenfw/gocrypt.(*CipherCrypt).Decrypt(0xc00021ed20, 0xc0001caf10, 0x20, 0x20, 0x1, 0xc000093e48, 0x1, 0x1, 0x0, 0x0, ...)
/golang/pkg/mod/github.com/yuchenfw/[email protected]/cipher.go:76 +0x264
使用AES-CBC-PKCS7方式解密,当给的源数据不合法时会报这种异常
博主你好:
putKey := []byte("EB2A38568661887FA180BDDB5CABD5F21C7BFD59C090CB2D245A87AC253062882729293E5506350508E7F9AA3BB77F4333231490F915F6D63C55FE2F08A49B353F444AD3993CACC02DB784ABBB8E42A9B1BBFFFB38BE18D78E87A0E41B9B8F73A928EE0CCEE1F6739884B9777E4FE9E88A1BBE495927AC4A799B3181D6442443")
in := bytes.NewReader(putKey)
priKey, _ := rsa.GenerateKey(in,1024)
rsa.GenerateKey 必须是传入rand.Reader生成公钥的, 如何给定pukKey生成特定的公钥?
rsa签名时如何使用pfx的证书?
现在DES都是过去式啦,市场上用的比较多的还是3DES加密啦
key1 由支付宝rsa工具生成 2048 pkcs1 的密钥
func TestPri(t *testing.T) {
key1 := ""
k, err := parsePrivateKey(b, Secret(1))
t.Log(k)
t.Log(err)
}
Error:
asn1: structure error: tags don't match (16 vs {class:0 tag:13 length:45 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} pkcs1PrivateKey @2
库内加密用的是x509.ParsePKIXPublicKey函数,即pcs8密钥格式,
但是解密用的是rsa.DecryptPKCS1v15函数,即pkcs1密钥格式,
一对正常生成的pck1密钥无法完成加解密
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.