login about faq

Hi I'm programming with your activex in VFP9 and I need help.

I want to call a webservice (https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte), with authentication certificate PFX.

For each transmission must be generated one unique symmetric key that is encrypted based on a digital certificate in accordance with the RSA algorithm and encoded in Base64

my code: locrypt= Createobject('Chilkat.Crypt2') lorsa = Createobject('Chilkat.Rsa') loSoapReq = Createobject('Chilkat.Xml') Cert = Createobject('Chilkat.Cert') lcUsername = "505622670/1" _lcPassword = "astuto4088"

lorsa.Charset = "utf-8" LOrsa.ImportPublicKey(PubKey.GetXml) loRsa.EncodingMode = "base64" loRsa.LittleEndian = 1 lorsa.VerboseLogging = 1 lorsa.OaepPadding = 0 locrypt.VerboseLogging = 1 loCrypt.CryptAlgorithm = "aes" loCrypt.CipherMode = "ebc" loCrypt.KeyLength = 128 loCrypt.CharSet = "utf-8" loCrypt.PaddingScheme = 0 loCrypt.EncodingMode = "base64" loHttp = CreateObject('Chilkat.Http') loReq = CreateObject('Chilkat.HttpRequest') loreq.HttpVerb = "POST" loReq.Path = "/sgdtws/documentosTransporte" loReq.AddHeader("SOAPAction","envioDocumentoTransporte") lcDomain = "https://servicos.portaldasfinancas.gov.pt" lnPort = 701 lnSsl = 1

?lohttp.SetSslClientCertPfx("c:EnvioGuiasTestesWebservices.pfx","TESTEwebservice","DGITA")

lcSecretKey = SUBSTR(lcUsername,7,2)+SUBSTR(TIME(),1,2)+; STR(INT(RAND()89)+10,2)+SUBSTR(TIME(),4,2)+; STR(INT(RAND()89)+10,2)+SUBSTR(TIME(),7,2)+; STR(INT(RAND()*89)+10,2)+SUBSTR(TIME(1),10,2) lcNonce = loRsa.EncryptStringENC(lcSecretKey,0)

?lcNonce

End code ****

The Nonce variable is empty.

What am I doing wrong?

Best regards from Portugal, Hugo Coelho

asked Apr 18 '13 at 10:15

chicl3t's gravatar image

chicl3t
1111

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1

Asked: Apr 18 '13 at 10:15

Seen: 1,020 times

Last updated: Apr 18 '13 at 10:15

Related questions

powered by OSQA