Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions crypto/cipher_decrypt.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package crypto

import (
"crypto/aes"

"github.com/go-faster/errors"

"github.com/gotd/ige"
Expand Down Expand Up @@ -72,12 +70,8 @@ func (c Cipher) decryptMessage(k AuthKey, encrypted *EncryptedMessage) ([]byte,
}

key, iv := Keys(k.Value, encrypted.MsgKey, c.encryptSide.DecryptSide())
cipher, err := aes.NewCipher(key[:])
if err != nil {
return nil, err
}
plaintext := make([]byte, len(encrypted.EncryptedData))
ige.DecryptBlocks(cipher, iv[:], plaintext, encrypted.EncryptedData)
ige.DecryptAES256Blocks(key[:], iv[:], plaintext, encrypted.EncryptedData)

return plaintext, nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/go-openapi/inflect v0.21.6
github.com/google/uuid v1.6.0
github.com/gotd/getdoc v0.53.0
github.com/gotd/ige v0.2.2
github.com/gotd/ige v0.3.0
github.com/gotd/log v0.1.0
github.com/gotd/log/logzap v0.1.1
github.com/gotd/neo v0.1.5
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ github.com/go-faster/jx v1.2.0 h1:T2YHJPrFaYu21fJtUxC9GzmluKu8rVIFDwwGBKTDseI=
github.com/go-faster/jx v1.2.0/go.mod h1:UWLOVDmMG597a5tBFPLIWJdUxz5/2emOpfsj9Neg0PE=
github.com/go-faster/sdk v0.34.0 h1:fDqrfjdNAZ/gu1yaAxGgEatguVjHhO0bfoQrDnp7gM4=
github.com/go-faster/sdk v0.34.0/go.mod h1:B9UTh3g1aku6MuNJlO5v0AgJX3W6tzQuzGZEkK3aBmM=
github.com/go-faster/xor v0.3.0/go.mod h1:x5CaDY9UKErKzqfRfFZdfu+OSTfoZny3w5Ak7UxcipQ=
github.com/go-faster/xor v1.0.0 h1:2o8vTOgErSGHP3/7XwA5ib1FTtUsNtwCoLLBjl31X38=
github.com/go-faster/xor v1.0.0/go.mod h1:x5CaDY9UKErKzqfRfFZdfu+OSTfoZny3w5Ak7UxcipQ=
github.com/go-faster/yaml v0.4.6 h1:lOK/EhI04gCpPgPhgt0bChS6bvw7G3WwI8xxVe0sw9I=
Expand All @@ -52,8 +51,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gotd/getdoc v0.53.0 h1:jO3QEFPM8oz9PAcMMXAjB2sVqSOeYUrUNcPvGyAGG/4=
github.com/gotd/getdoc v0.53.0/go.mod h1:dGzxEXIknZKAjGTbm9Axgx5LJqR/FBvHkoaPfnstmNw=
github.com/gotd/ige v0.2.2 h1:XQ9dJZwBfDnOGSTxKXBGP4gMud3Qku2ekScRjDWWfEk=
github.com/gotd/ige v0.2.2/go.mod h1:tuCRb+Y5Y3eNTo3ypIfNpQ4MFjrnONiL2jN2AKZXmb0=
github.com/gotd/ige v0.3.0 h1:4f6LEHWsVDLBG0bT9wWG2/9TZb5aWm265G8ZlTXmRRU=
github.com/gotd/ige v0.3.0/go.mod h1:FE9bTaQtvfArizAcZuI4sS6gXaEUBmixdUufVHoCKac=
github.com/gotd/log v0.1.0 h1:4LJUEvafD1xtBwx2QkrlzFnRgbYXTlWqJPDi8BvrLbU=
github.com/gotd/log v0.1.0/go.mod h1:5ilhdu1Ux0QvDY/FF3Ojfw24Ws3SlCtyLwOpXy8KYXs=
github.com/gotd/log/logzap v0.1.1 h1:O6l7d8HUbODe+UMcrM47eXYDwdJ6RNmpQejLjrlcEIQ=
Expand Down
Loading