EldoS | Feel safer!

Software components for data protection, secure storage and transfer

The smart card is not fully personalized for use

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#34900
Posted: 10/27/2015 07:25:46
by Zekeriya KAVAKER (Basic support level)
Joined: 10/27/2015
Posts: 1

Hello,
Our software was working correctly until Windows 8 x64, so we decided to upgrade secureblackbox to version 12.0.269, but now it says "The smart card is not fully personalized for use". We use Delphi 7 and source code is below, can you help us?

Thanks




Refs := TElXMLReferenceList.Create;
Ref := TElXMLReference.Create;
CertStorage := TElMemoryCertStorage.Create(nil);
Signer := TElXMLSigner.Create(nil);
XAdESSigner := TElXAdESSigner.Create(nil);
X509KeyData := TElXMLKeyInfoX509Data.Create(False);
myWinCertStorage := TElWinCertStorage.Create(NIL);
try
myWinCertStorage.SystemStores.Text := 'MY';
Ref.DigestMethod := xdmSHA256;
Ref.URINode := pRootElement;
Ref.URI := '';
Ref.TransformChain.Add(TElXMLEnvelopedSignatureTransform.Create);
Refs.Add(Ref);

//ENVELOPED
Signer.SignatureType := xstEnveloped;
Signer.CanonicalizationMethod := xcmCanonComment;
Signer.SignatureMethodType := xmtSig;
Signer.SignatureMethod := xsmRSA_SHA256;
Signer.References := Refs;
Signer.KeyName := '';
Signer.IncludeKey := true;

Signer.OnFormatElement := FormatElement;
Signer.OnFormatText := FormatText;

//Find the right certificate and assign
Cert:= Find_eMuhur_Certificate(CompanyInfo.Id);

if not Assigned(Cert) or not Cert.PrivateKeyExists then
raise EElXMLError.Create('The selected certificate doesn`t contain a private key.');

CertStorage.Add(Cert);

X509KeyData.Certificate := Cert;
Signer.KeyData := X509KeyData;

//---------------------------------------------------------
// XADES BEGIN
//---------------------------------------------------------
Signer.XAdESProcessor := XAdESSigner;
XAdESSigner.XAdESVersion := XAdES_v1_3_2;
XAdESSigner.PolicyId.SigPolicyId.Description := '';
XAdESSigner.PolicyId.SigPolicyId.IdentifierQualifier := xqtNone;
XAdESSigner.SigningCertificatesDigestMethod:= xdmSHA256;
XAdESSigner.SigningCertificates := CertStorage;
XAdESSigner.SigningTime := LocalTimeToUTCTime(Now);

// create XAdESSigner.QualifyingProperties
XAdESSigner.Generate;

// Finally we can modify QualifyingProperties if needed
// For example set xades prefix:
XAdESSigner.QualifyingProperties.XAdESPrefix := 'xades';
//---
XAdESSigner.QualifyingProperties.SignedProperties.SignedSignatureProperties.SignerRole.ClaimedRoles.AddText(XAdESSigner.XAdESVersion, FXMLDocument, 'Supplier');
XAdESSigner.QualifyingProperties.Target:= QualifyingProperties_Target;
XAdESSigner.QualifyingProperties.SignedProperties.ID:= SignedProperties_Id;
XAdESSigner.QualifyingProperties.SignedProperties.SignedSignatureProperties.SignaturePolicyIdentifier.Clear;
//---------------------------------------------------------
// XADES END
//---------------------------------------------------------

Signer.UpdateReferencesDigest;
Signer.GenerateSignature();

// SET SIGNATURE ID ATTR
Signer.Signature.ID:= Signature_Id;
Signer.Signature.SignedInfo.ID:= SignedInfo_Id;
Signer.Signature.SignatureValue.ID:= SignatureValue_Id;
Signer.Signature.SignedInfo.SigPropRef.DigestMethod := xdmSHA256;
Signer.Signature.SignedInfo.SigPropRef.ID := SignedPropertiesObjRef_Id;

ExtensionContentNode.TextContent:= '' ;
SigNode:= ExtensionContentNode;

try
//If the signature type is enveloped, the signature is placed as a child of the passed node.
Signer.Save(SigNode);
except
on E: Exception do
raise EElXMLError.CreateFmt('Failed to sign data and to save the signature: (%s)', [E.Message]);
end;

SignatureElement:= FindElementByName(TElXmlDomElement(SigNode), 'Signature', TargetNameSpaceURI_ds);
RemoveAttribute(SignatureElement, 'xmlns:ds');

ObjectElement:= FindElementByName(SignatureElement, 'Object', TargetNameSpaceURI_ds);
QualifyingPropertiesElement:= FindElementByName(ObjectElement, 'QualifyingProperties', TargetNameSpaceURI_xades);
RemoveAttribute(QualifyingPropertiesElement, 'xmlns:xades');
finally
FreeAndNil(Signer);
FreeAndNil(XAdESSigner);
// FreeAndNil(RSAKeyData);
FreeAndNil(X509KeyData);
// FreeAndNil(PGPKeyData);
// FreeAndNil(Cert);
FreeAndNil(Refs);
FreeAndNil(CertStorage);
// FreeAndNil(Ref);
FreeAndNil(myWinCertStorage);
end;
#34901
Posted: 10/27/2015 08:28:11
by Vsevolod Ievgiienko (Team)

Thank you for contacting us.

I’ve noticed there is no Support Access Ticket linked to your user account on EldoS site. Technical Support is provided to customers with the linked Support Access Ticket. You will find your Support Access Ticket together with all the details about how to use it in the registration e-mail that we’ve sent to you upon the purchase.

Reply

Statistics

Topic viewed 2432 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!