Capicom: sign error

Capicom: sign error

Secure Home | Search | About
 Microsoft Applications Security    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content add this group's latest topics to your Google content
Subject Author Date
Capicom: sign error CVMolina 06-23-2005
Posted by =?Utf-8?B?Q1ZNb2xpbmE=?= on June 23, 2005, 3:04 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
Hi,
I'm using CAPICOM 2.0.0.3 for signing in a web app. I'm having an error
during the signing process
with some certificates. Some others works fine.

The error occurs in this line:
"Message = SignedData.Sign(Signer, TRUE)" in the "signCapi" function

The error that appeared in a message box after having selected his
certificate is the following:

"VBScript -2138570157 The signer´s certificate in not valid for signing"

I think this code in this error code page for CAPICOM (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/capicom_error_code.asp
)

correspond to this:
---------------------------------
= 0x80880253 //v2.0,
CAPICOM_E_SIGN_NOT_INITIALIZED
The SignedData object has not been initialized.
To initialize the SignedData object, set the Content property or call
the Verify method.
---------------------------------


Some of the code is:
------------------------------------------------------
Const CAPICOM_URL =
"http://www.microsoft.com/downloads/release.asp?ReleaseID=44155"
Const TITULO_ERROR = "Firma de Texto..."
Const TITULO_INFO = "Verificación de Firma y Certificado..."

' Constantes de la CAPICOM...
Const CAPICOM_MEMORY_STORE = 0
Const CAPICOM_LOCAL_MACHINE_STORE = 1
Const CAPICOM_CURRENT_USER_STORE = 2
Const CAPICOM_MY_STORE = "MY"
Const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3
Const CAPICOM_SMART_CARD_USER_STORE = 4
Const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0

Const CAPICOM_STORE_OPEN_READ_ONLY = 0
Const CAPICOM_STORE_OPEN_READ_WRITE = 1
Const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2
Const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128
Const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256
Const CAPICOM_VERIFY_SIGNATURE_AND_CERTIFICATE = 1
Const CAPICOM_ENCODE_BASE64 = 1

Dim StoreName : StoreName = "MY"
Dim Signer, SignedData, Certificate, Message, oConvert

Dim oStore
Dim oCertificates

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function llenarCombos
on error resume next

Set oStore = CreateObject("CAPICOM.Store")

oStore.Open CAPICOM_CURRENT_USER_STORE, CAPICOM_MY_STORE,
CAPICOM_STORE_OPEN_READ_ONLY Or CAPICOM_STORE_OPEN_EXISTING_ONLY

Set oCertificates = oStore.Certificates
Dim oCertificate

For Each oCertificate in oCertificates
If(oCertificate.HasPrivateKey()) Then

agregarOpcion(oCertificate.GetInfo(CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME))
End If
Next
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function signCapi(texto, certificado)
Set Signer = CreateObject("CAPICOM.Signer")

Signer.Certificate = oCertificates(certificado + 1)

Set oStore = Nothing
Set oCertificates = Nothing

Set SignedData = CreateObject("CAPICOM.SignedData")
Set oConvert = CreateObject("ConvertString.Convert")
SignedData.Content = oConvert.StrConvert(texto)

On Error Resume Next

Message = SignedData.Sign(Signer, TRUE)

If (Err.Number <> 0) Then
MsgBox "Error: " & CStr(Err.Number) & " " & Err.Description
End If

' Muestra la firma...
pkcs7.innerText = Message
pkcs7.style.display = ""

firmarCapi = Message
Set SignedData = Nothing
On Error GoTo 0
End Function

------------------------------------------------------

Thanks!


Similar ThreadsPosted
CAPICOM: Is it possible to sign multiple files... August 22, 2005, 12:48 pm
Sign in and sign out for multiple account users February 9, 2006, 3:32 pm
CAPICOM problem in .NET 2.0 February 28, 2007, 10:02 am
CAPICOM and CSR or PKCS#10 March 5, 2008, 8:52 am
Capicom Security Alert November 16, 2006, 10:35 am
Need help with CAPICOM Security APIs August 8, 2007, 9:59 am
Re: CAPICOM.EnvelopedData decrypt: where to put certificate? June 22, 2005, 3:24 pm
Encryption on Windows 2000 with capicom December 1, 2005, 7:17 pm
"include in CDP" extention error - Reproducible error: March 4, 2008, 9:42 pm
msn sign in security July 1, 2005, 11:32 am

The site map in XML format XML site map

Contact Us | Privacy Policy