Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - HendersonS

#1
mike, I can Access without problems to: https://www.myserver.com/somefolder/restapi.pxp?route=/customers

The problem comes when I use AliasMatch and try to Access to: https://www.myserver.com/api/customers

I will continue investigating to see Apache permissions with directories

HendersonS
#2
Quote from: Mike King on December 17, 2024, 04:35:40 PMIf using Apache you can likely use AliasMatch or RedirectMatch to accomplish this.  Something like:

AliasMatch "^/api/(.*)" "/somefolder/restapi.pxp?route=/$1"

RedirectMatch would let you route to another server.

Using a generic match means you only need to setup one redirection/alias.

hi mike,

Have you tried this configuration? because I have tried it in every possible way and Apache always returns 403 forbidden, Maybe I'm doing something wrong but I don't know what it is, I mean I gave permissions to the directory, Alias works but AliasMatch doesn't.

Do you have any idea what might be wrong?

thanks in advance.
HendesonS
#3
Thanks Mike/Stéphane , I'm going to try that.
#4
Hello Stéphane,

I know this is a very old post, but can I ask you how you were able to make the rest api with pxplus, I mean, do you have to write every endpoint in the URL rewrite?

Thanks,
Henderson
#5
Programming / Re: Mobile application
September 18, 2024, 06:30:10 PM
Hi everyone, is there a way to download a copy of the demo that is at https://demosite.pvxplus.com/?
#6
Hi,
Jeff and Stéphane, thank you for your help, I was finally able to find the solution with the help you gave me.

the line looked like this:
Content-Disposition: form-data; name="xml"; filename="xmlsing.xml"
#7
jeff,

I tested both ways that you showed me and I still get the same "invalid file" response, I will continue trying...
#8
jeff, this is what it returns:

1>print mid(body$,1,300)
------PxPlusFormDataBoundary_zNYKbtQdhRIYGlYIDBoKNPAdi7un9gGR
Content-Disposition: form-data; name="xmlsing"; filename="xmlsing.xml"
Content-Type: text/xml

<?xml version="1.0" encoding="utf-8"?>
<SemillaModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="h
ttp://www.w3.
1>
#9
Jeff thanks for your help,

I have something very similar to what you showed, I also added Stephane's program to calculate the boundaries but when I send it with pxplus the API returns an "invalid file" error, I tried it with CURL and the api receives the file correctly, does it work? How could I replicate it? in Pxplus?

Example with CURL: curl -X 'POST' \
  'https://url/api' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'xml=@xmldata.xml;type=text/xml'

#10
Hi Jeff, I'm stuck in the same place trying to send a file via API, could you post the final solution? Maybe it can help me too!
#11
Programming / Re: *web\request
April 01, 2024, 09:57:37 PM
Jeffrey Ferreira,
I'm working on something similar, how did you create the boundary?
#12
Loren, thanks for your demonstration,

so far I have not been able to install xmlsec on Windows, and I have not been able to find a solution with pxplus either, so I will have to make some program in C# or another language to invoke it from pxplus, since I do not see a solution with pxplus.
#13
Thanks Mike for your instructions.

If I understood correctly, you mean that I can invoke this tool from pxplus? And just in case I take another route to do it with pxplus, is there any utility to extract the private key from a .pem?
#14
Loren thanks for yor reply

Below is the structure that the signature node should have within the xml, I have no experience in building these signatures. Maybe you can show me some example code to do it.

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/RECxml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsigmore#rsa-sha256" />
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#envelope d-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
<DigestValue>Atr9H7DiGlxrQOFII/hFihsL6ACiwe47Oo93tgtuera=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>gQyXO0FFDGIITESTpP5xZjLIRtv/Q7/ixe1lNDLDA5aw...</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>DGIITESTBFagAwIBAgIIInYGQUX9q0IwDQYJKoZIhvcNAQ...</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
#15
Programming / Sign XML Documents with Digital Signatures
February 18, 2024, 04:05:16 PM
Hello everyone,
recently we are working on web services that use digitally signed xml files for validation, these xml files must be signed with digital certificates (.P12 files), does anyone have experience doing this? Or can you guide us how to do this in Pvx Plus? Any idea is welcome, thank you very much in advance.

Below is some example code in VB.NET. Any idea how we can replicate it in pxplus?


''' <summary>
''' Method for signing XML with digital certificate (*.p12)
''' </summary>
''' <param name="xmlDoc"> document to sign </param>
''' <param name="pathCert">location of certificate to use for signing </param>
''' <param name="passCert">digital certificate password</param>
''' <returns>Digitally signed XML</returns>
Private Function Signed (ByVal xmlDoc As XmlDocument, ByVal pathCert As String, ByVal
passCert As String) As XmlDocument
Try
If Not File.Exists(pathCert) Then Throw New Exception("The signing certificate does not exist")
Dim cert = New X509Certificate2(pathCert, passCert, X509KeyStorageFlags.Exportable)
Dim exportedKeyMaterial = cert.PrivateKey.ToXmlString(True)
Dim key = New RSACryptoServiceProvider(New CspParameters(24))
key.PersistKeyInCsp = False
key.FromXmlString(exportedKeyMaterial)
Dim signedXml As SignedXml = New SignedXml(xmlDoc)
  signedXml.SigningKey = key
  signedXml.SignedInfo.SignatureMethod =
"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
  Dim reference As Reference = New Reference()
  reference.AddTransform(New XmlDsigEnvelopedSignatureTransform())
  reference.DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256"
  reference.Uri = ""
  signedXml.AddReference(reference)
  Dim keyInfo As KeyInfo = New KeyInfo()
  keyInfo.AddClause(New KeyInfoX509Data(cert))
  signedXml.KeyInfo = keyInfo
  signedXml.ComputeSignature()
  Dim xmlDigitalSignature As XmlElement = signedXml.GetXml()
  xmlDoc.DocumentElement.AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, True))
  Return xmlDoc
  Catch ex As Exception
  Throw ex
  End Try
End Function