Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
github.com/blockchain-cn/keygen
Asymmetric encryption algorithm impliment. 使用rsa生成公钥和私钥,使用私钥进行信息签名,公钥验证结果
// RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5.
func SignPKCS1v15(rand io.Reader, priv *PrivateKey, hash crypto.Hash, hashed []byte) ([]byte, error)
// VerifyPKCS1v15 verifies an RSA PKCS#1 v1.5 signature.
func VerifyPKCS1v15(pub *PublicKey, hash crypto.Hash, hashed []byte, sig []byte) error
原生rsa "crypto/rsa"
在keypool目录下注册一个${user}文件夹,并在其中生成公钥、私钥
func GenRsaKey(bits int, user string) error
// 使用
GenRsaKey(bits, "路达")
通过用户获得用户目录,并根据目录,获取其中文件的密钥md5,公钥私钥都可以
func GetUserPath(user string) string
func GetKeyMd5(p string) (s string, err error)
// 使用
pbKeyPath := path.Join(GetUserPath("路达"), "public.pem")
pb, err:= GetKeyMd5(pbKeyPath)
根据用户名/或者直接输入私钥进行数据签名
func Signature(user string, data []byte) (pb, c string, err error)
func Signature2(pv string, data []byte) (c string, err error)
// 使用1
pb, ciphertext, err := Signature("路达", []byte("向优格特转账1000000"))
// 使用2
pv, err:= GetKeyMd5(path.Join(GetUserPath("路达"), "private.pem"))
pb, err:= GetKeyMd5(path.Join(GetUserPath("路达"), "public.pem"))
ciphertext, err := Signature2(pv, []byte("向优格特转账1000000"))
根据用户id(公钥)进行${签名}到${传输数据}的验证
func Verify(pb, c string, data []byte) error
// 使用
err := Verify(pb, ciphertext, []byte("向优格特转账1000000"))
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.