aa
This commit is contained in:
@@ -130,7 +130,6 @@ func (a *API) Decrypt(sign, timestr, nonce, msg string) (decryptedMsg string, er
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
c := NewDingTalkCrypto(a.GetCallbackToken(), string(a.GetCallbackAESKey()), a.corpID)
|
c := NewDingTalkCrypto(a.GetCallbackToken(), string(a.GetCallbackAESKey()), a.corpID)
|
||||||
fmt.Println("1111111111111111111111111111111111111111111111111111")
|
|
||||||
return c.GetDecryptMsg(sign, timestr, nonce, msg)
|
return c.GetDecryptMsg(sign, timestr, nonce, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,13 +245,16 @@ func NewDingTalkCrypto(token, encodingAESKey, suiteKey string) *DingTalkCrypto {
|
|||||||
}
|
}
|
||||||
func (c *DingTalkCrypto) GetDecryptMsg(signature, timestamp, nonce, secretMsg string) (string, error) {
|
func (c *DingTalkCrypto) GetDecryptMsg(signature, timestamp, nonce, secretMsg string) (string, error) {
|
||||||
if !c.VerificationSignature(c.Token, timestamp, nonce, secretMsg, signature) {
|
if !c.VerificationSignature(c.Token, timestamp, nonce, secretMsg, signature) {
|
||||||
|
fmt.Println("33333333333333333333333333333")
|
||||||
return "", errors.New("ERROR: 签名不匹配")
|
return "", errors.New("ERROR: 签名不匹配")
|
||||||
}
|
}
|
||||||
decode, err := base64.StdEncoding.DecodeString(secretMsg)
|
decode, err := base64.StdEncoding.DecodeString(secretMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("1111111111111111111111", err)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if len(decode) < aes.BlockSize {
|
if len(decode) < aes.BlockSize {
|
||||||
|
fmt.Println("2222222222222222222222222222222", err)
|
||||||
return "", errors.New("ERROR: 密文太短")
|
return "", errors.New("ERROR: 密文太短")
|
||||||
}
|
}
|
||||||
blockMode := cipher.NewCBCDecrypter(c.Block, c.BKey[:c.Block.BlockSize()])
|
blockMode := cipher.NewCBCDecrypter(c.Block, c.BKey[:c.Block.BlockSize()])
|
||||||
|
|||||||
Reference in New Issue
Block a user