Skip to content

Commit 741d495

Browse files
committed
fix: simplify NOSONAR comment format for SonarCloud
1 parent bf685f0 commit 741d495

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pkg/didcomm/crypto/jwe.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ func encryptA256CBCHS512(plaintext, cek, aad []byte) (ciphertext, tag, iv []byte
491491

492492
ciphertext = make([]byte, len(padded))
493493
//nolint:gosec // RFC 7518 A256CBC-HS512 requires CBC mode - this is authenticated encryption with HMAC-SHA-512
494-
mode := cipher.NewCBCEncrypter(block, iv) //NOSONAR go:S5542
494+
mode := cipher.NewCBCEncrypter(block, iv) //NOSONAR
495495
mode.CryptBlocks(ciphertext, padded)
496496

497497
// Compute HMAC-SHA-512 tag
@@ -634,7 +634,7 @@ func wrapKeyAES(cek, wrappingKey []byte) ([]byte, error) {
634634
copy(b[:8], a)
635635
copy(b[8:], r[i])
636636
//nolint:gosec // RFC 3394 AES Key Wrap - this is a key-wrapping primitive with integrity check
637-
block.Encrypt(b, b) //NOSONAR go:S5542
637+
block.Encrypt(b, b) //NOSONAR
638638

639639
// A = MSB(64, B) ^ t where t = (n*j)+i
640640
t := uint64(n*j + i)
@@ -945,7 +945,7 @@ func decryptA256CBCHS512(ctx context.Context, msg *EncryptedMessage, header *JWE
945945
}
946946

947947
//nolint:gosec // RFC 7518 A256CBC-HS512 - HMAC authentication verified above before decryption
948-
mode := cipher.NewCBCDecrypter(block, iv) //NOSONAR go:S5542
948+
mode := cipher.NewCBCDecrypter(block, iv) //NOSONAR
949949
plaintext := make([]byte, len(ciphertext))
950950
mode.CryptBlocks(plaintext, ciphertext)
951951

@@ -1125,7 +1125,7 @@ func unwrapKeyAES(wrappedKey, wrappingKey []byte) ([]byte, error) {
11251125
copy(b[:8], a)
11261126
copy(b[8:], r[i])
11271127
//nolint:gosec // RFC 3394 AES Key Unwrap - integrity check validates after unwrap
1128-
block.Decrypt(b, b) //NOSONAR go:S5542
1128+
block.Decrypt(b, b) //NOSONAR
11291129

11301130
// A = MSB(64, B)
11311131
copy(a, b[:8])

pkg/pki/keymaterial_signer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (s *KeyMaterialSigner) SignDigest(ctx context.Context, digest []byte) ([]by
7373
// widely used in JWT RS256/RS384/RS512. It's distinct from RSA-PKCS1v15 encryption
7474
// which has known vulnerabilities. The signature scheme is secure.
7575
hash := getHashForAlgorithm(s.km.SigningMethod.Alg())
76-
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec // NOSONAR go:S5542 - This is signature, not encryption
76+
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec //NOSONAR
7777
default:
7878
return nil, fmt.Errorf("unsupported key type: %T", s.km.PrivateKey)
7979
}

pkg/pki/software.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (s *SoftwareSigner) SignDigest(ctx context.Context, digest []byte) ([]byte,
7979
// widely used in JWT RS256/RS384/RS512. It's distinct from RSA-PKCS1v15 encryption
8080
// which has known vulnerabilities. The signature scheme is secure.
8181
hash := getHashForAlgorithm(s.algorithm)
82-
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec // NOSONAR go:S5542 - This is signature, not encryption
82+
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec //NOSONAR
8383
case *ecdsa.PrivateKey:
8484
// Sign the digest directly using ECDSA
8585
r, sigS, err := ecdsa.Sign(rand.Reader, key, digest)

0 commit comments

Comments
 (0)