I am using the following code to get my certificate and sign my CNPJs, however I am using the SHA256 algorithm, but it is returning 128bytes. Does anyone know what's wrong? Follow the Code:
Dim data = Encoding.UTF8.GetBytes(Me.txtCNPJSoftwareHouse.Text + Me.txtCNPJEmpresa.Text)
Dim csp As RSACryptoServiceProvider = DirectCast(cert.PrivateKey, RSACryptoServiceProvider)
' cert = certificado X509
Dim sha As New SHA256Managed()
Dim hash As Byte() = sha.ComputeHash(data)
Dim encrypted As Byte() = csp.SignHash(hash, CryptoConfig.MapNameToOID("SHA256"))
Me.txtBox.Text = Convert.ToBase64String(encrypted)
The variable date is 28 bytes long.
The hash variable is 32 bytes long.
The encrypted variable has 128 bytes < - PROBLEM
In the end my txtBox.text gets only 172Bytes and should get 344bytes if the "encrypted" variable was receiving 256bytes