Beispiel #1
0
func signDataSHA1(key *rsa.PrivateKey, data string) ([]byte, error) {
	hash := sha1.New()
	io.WriteString(hash, data)
	sum := hash.Sum(nil)

	signed, err := key.Sign(rand.Reader, sum, crypto.SHA1)
	if err != nil {
		return []byte{}, err
	}
	return signed, nil
}