Welcome to the hell we created or something

master
eater 5 years ago
parent ced1df310f
commit c4d7759b00
Signed by: eater
GPG Key ID: 656785D50BE51C0A

@ -1,6 +1,7 @@
package service package service
import ( import (
"crypto"
cipher2 "crypto/cipher" cipher2 "crypto/cipher"
"crypto/rand" "crypto/rand"
"crypto/rsa" "crypto/rsa"
@ -68,7 +69,7 @@ func DecryptAndVerify(input []byte, key *rsa.PrivateKey, pub *rsa.PublicKey, sig
fingerprint := signature fingerprint := signature
fingerprintHashed := sha256.Sum256(fingerprint) fingerprintHashed := sha256.Sum256(fingerprint)
err = rsa.VerifyPKCS1v15(pub, 0, fingerprintHashed[:], recvSignature) err = rsa.VerifyPKCS1v15(pub, crypto.SHA256, fingerprintHashed[:], recvSignature)
return err return err
} }
@ -98,7 +99,7 @@ func EncryptAndSign(v Message, key *rsa.PrivateKey, pub *rsa.PublicKey, signatur
} }
hashedFingerpint := sha256.Sum256(signature) hashedFingerpint := sha256.Sum256(signature)
plainSignature, err := rsa.SignPKCS1v15(rand.Reader, key, 0, hashedFingerpint[:]) plainSignature, err := rsa.SignPKCS1v15(rand.Reader, key, crypto.SHA256, hashedFingerpint[:])
if err != nil { if err != nil {
return err return err
} }

Loading…
Cancel
Save