Giter Site home page Giter Site logo

gocrypt's People

Contributors

housemecn avatar yuchenfw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gocrypt's Issues

AES-CBC-PKCS7解密异常

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方式解密,当给的源数据不合法时会报这种异常

如何给定特定的pubkey生成rsa公钥?

博主你好:

putKey := []byte("EB2A38568661887FA180BDDB5CABD5F21C7BFD59C090CB2D245A87AC253062882729293E5506350508E7F9AA3BB77F4333231490F915F6D63C55FE2F08A49B353F444AD3993CACC02DB784ABBB8E42A9B1BBFFFB38BE18D78E87A0E41B9B8F73A928EE0CCEE1F6739884B9777E4FE9E88A1BBE495927AC4A799B3181D6442443")

in := bytes.NewReader(putKey)
priKey, _ := rsa.GenerateKey(in,1024)

rsa.GenerateKey 必须是传入rand.Reader生成公钥的, 如何给定pukKey生成特定的公钥?

pkcs1 2048 to private error

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

rsa加密解密存在问题

库内加密用的是x509.ParsePKIXPublicKey函数,即pcs8密钥格式,
但是解密用的是rsa.DecryptPKCS1v15函数,即pkcs1密钥格式,
一对正常生成的pck1密钥无法完成加解密

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.