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