I'm currently trying to create a C++ program to track prices for a bunch of ASINs.
I'm using C++ with Qt (Version 5.5), compiling on mac OSX through Xcode (5.1.1).
When compiling, it's running but no output is given. I have the following warning message instead (I encrypted AccessKey & AssociateTag for privacy reasons as "/////////////")
*QUrl("http://ecs.amazonaws.com/onca/xml?AWSAccessKeyId=///////////////&AssociateTag=/////////////&ItemId=B00181T20O&Operation=ItemLookup&ResponseGroup=OfferSummary&Service=AWSECommerceService&Signature=1K69SLmTkZ9hZwwt5ualR4uDRwY%3D&SignatureMethod=HmacSHA1&Timestamp=2017-01-04T10%3A21%3A46Z")
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
qt.network.ssl: Error receiving trust for a CA certificate
"<?xml version=\"1.0\"?>\n<ItemLookupErrorResponse
xmlns=\"http://ecs.amazonaws.com/doc/2005-10-05/\"><Error>
<Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated
does not match the signature you provided. Check your AWS Secret Access Key and
signing method. Consult the service documentation for details.</Message></Error>
<RequestId>f4626242-a110-43f1-9b56-b8a696b3f299</RequestId>
</ItemLookupErrorResponse>"
RET:
("", "")*
To test it again, I copied URL (first few rows of warning message) in the browser and I get the same error as well:
"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."
Can anyone give me a hint of what's wrong in the URL?
Thanks in advance!
this is the most relevant part of the code. I suspect I cannot embed .zip file
AWSQueryRequest::AWSQueryRequest(QObject *parent) :
QObject(parent)
{
m_netManager = new QNetworkAccessManager(this);
}
QString AWSQueryRequest::hmacSha1(QByteArray key, QByteArray baseString)
{
int blockSize = 64; // HMAC-SHA-1 block size, defined in SHA-1 standard
if (key.length() > blockSize)
{
// if key is longer than block size (64), reduce key length with SHA-1 compression
key = QCryptographicHash::hash(key, QCryptographicHash::Sha1);
}
QByteArray innerPadding(blockSize, char(0x36)); // initialize inner padding with char "6"
QByteArray outerPadding(blockSize, char(0x5c)); // initialize outer padding with char "quot;
// ascii characters 0x36 ("6") and 0x5c ("quot;) are selected because they have large
// Hamming distance (http://en.wikipedia.org/wiki/Hamming_distance)
for (int i = 0; i < key.length(); i++)
{
innerPadding[i] = innerPadding[i] ^ key.at(i); // XOR operation between every byte in key and innerpadding, of key length
outerPadding[i] = outerPadding[i] ^ key.at(i); // XOR operation between every byte in key and outerpadding, of key length
}
// result = hash ( outerPadding CONCAT hash ( innerPadding CONCAT baseString ) ).toBase64
QByteArray total = outerPadding;
QByteArray part = innerPadding;
part.append(baseString);
total.append(QCryptographicHash::hash(part, QCryptographicHash::Sha1));
QByteArray hashed = QCryptographicHash::hash(total, QCryptographicHash::Sha1);
return hashed.toBase64();
}
QByteArray AWSQueryRequest::getTimeStamp()
{
QDateTime dateTime = QDateTime::currentDateTimeUtc();
return dateTime.toString(Qt::ISODate).toUtf8();
}
QByteArray AWSQueryRequest::createSignature(const QMap<QString,QString> & queryItems)
{
QUrl url(END_POINT);
QString stringToSign = "GET\n";
stringToSign.append(url.host() + "\n");
stringToSign.append(url.path() + "\n");
QList<QString> keys = queryItems.keys();
for( int i=0; i < keys.count() ; ++i )
{
stringToSign.append(keys[i]+"="+queryItems[keys[i]]);
if( i != keys.count() -1 )
stringToSign.append("&");
}
QString signature = hmacSha1(AWS_PASS, stringToSign.toUtf8());
return QUrl::toPercentEncoding(signature);
}
#if 0
QByteArray AWSQueryRequest::createSignature(const QList< QPair<QString,QString> > & queryItems)
{
QUrl url(END_POINT);
QString stringToSign = "GET\n";
stringToSign.append(url.host() + "\n");
stringToSign.append(url.path() + "\n");
for (int i=0; i<queryItems.count(); ++i)
{
QPair<QString,QString> pairValue = queryItems[i];
stringToSign.append(pairValue.first+"="+pairValue.second);
if( i != queryItems.count() -1)
stringToSign.append("&");
}
QString signature = hmacSha1(AWS_PASS, stringToSign.toUtf8());
return QUrl::toPercentEncoding(signature);
}
#endif
QUrl AWSQueryRequest::createUrl( const QMap< QString,QString >& queryItems )
{
QUrl url(END_POINT);
QUrlQuery query;
QMapIterator<QString, QString> it(queryItems);
while (it.hasNext())
{
it.next();
query.addQueryItem(it.key().toUtf8(), it.value().toUtf8());
}
url.setQuery(query);
return url;
}
Related
I would like to create a certificate with ECC. I am using ecdsa_with_SHA3-512 as signature algorithm.
I can succesfully sign the certificate as below.
auto message_digest = EVP_MD_fetch(nullptr,"SHA3-512", nullptr);
if (!message_digest) {
...
}
if(auto ssize = X509_sign(cert,pkey,message_digest)){
...
}
But I can`t verify the signature as below.
auto result = X509_verify(cert,pkey);
if (result <= 0) {
printf("[verify is failed : %d]\n",result);
}
auto errCode = ERR_peek_last_error();
auto errBuf = new char[256];
ERR_error_string(errCode,errBuf);
std::cout << errBuf << "\n";
I get [verify result : -1] error:068000C7:asn1 encoding routines::unknown signature algorithm error message.
I am checking tbs signature and certificate signature objects, they are equal.
if(X509_ALGOR_cmp(signatureAlg, tbsSignature)) {
...
}
Below is tbs signature object fields.
tbs signature ln : ecdsa_with_SHA3-512
tbs signature sn : id-ecdsa-with-sha3-512
tbs signature nid : 1115
As I understand X509_verify() checks the signature algorithm nid from
nid_triple sigoid_srt[] array. And cant find NID_ecdsa_with_SHA3_512 algorithm nid. Because of this, it gives unkown algorithm error.
I am new to cryptography and openssl, What I am missing.
Edit : This hash/signature algorithm combination is not
supported by any of the current releases by itself.
I'm trying to achieve an LTV signature using PDFTron, but I don't know how to add DSS information.
I'm using this sample code, but I don't know how to enable LTV for my signature.
In their sample, they are enabling LTV for the Document Timestamp Signature field, not for the initial signature field
https://www.pdftron.com/documentation/samples/cpp/DigitalSignaturesTest
My signature looks like this
But
I want my signature to look like this
I'm using a custom signature handler (OpenSSLSignature Handler)
Please try to use below c++ code.
#define _CRT_SECURE_NO_WARNINGS
#include <openssl/applink.c>
#include “OpenSSLSignatureHandler.h”
void SignPDF(const UString& in_docpath, const UString& in_approval_field_name, const UString& in_private_key_file_path, const UString& in_keyfile_password, const UString& in_appearance_img_path, const UString& in_outpath) { /*
During the certification of a document, you are still using a digital signature to guarantee the integrity of the document. However, you are also adding additional restriction on the document preventing further action on it.
The certification of a document being a reliable option, no futher action is possible once this has been applied: :the modification will then need to be done on the original « non-sign/certified » document.
The option to certify is only available to the first signer of the document.
*/
cout << "================================================================================" << endl; cout << "Signing PDF document" << endl;
// Open an existing PDF PDFDoc doc(in_docpath);
// Retrieve the unsigned approval signature field. Field found_approval_field(doc.GetField(in_approval_field_name)); PDF::DigitalSignatureField found_approval_signature_digsig_field(found_approval_field);
// Add an appearance to the signature field. PDF::Image img = PDF::Image::Create(doc, in_appearance_img_path); Annots::SignatureWidget found_approval_signature_widget(found_approval_field.GetSDFObj()); found_approval_signature_widget.CreateSignatureAppearance(img);
// Prepare the signature and signature handler for signing. OpenSSLSignatureHandler sigHandler(in_private_key_file_path.ConvertToUtf8().c_str(), in_keyfile_password.ConvertToUtf8().c_str()); SignatureHandlerId sigHandlerId = doc.AddSignatureHandler(sigHandler); found_approval_signature_digsig_field.SignOnNextSaveWithCustomHandler(sigHandlerId);
/* Add to the digital signature dictionary a SubFilter name that uniquely identifies the signature format for verification tools. As an example, the custom handler defined in this file uses the CMS/PKCS #7 detached format, so we embed one of the standard predefined SubFilter values: "adbe.pkcs7.detached". It is not necessary to do this when using the StdSignatureHandler. */ Obj f_obj = found_approval_signature_digsig_field.GetSDFObj(); f_obj.FindObj("V").PutName("SubFilter", "adbe.pkcs7.detached");
// The actual approval signing will be done during the following incremental save operation. doc.Save(in_outpath, SDFDoc::e_incremental, NULL);
cout << "================================================================================" << endl; }
void addDTSandEnableLTV(const UString& in_docpath,const UString& in_approval_field_name,const UString& tsa_cer_path,const UString& in_outpath) { PDFDoc doc(in_docpath);
Field found_approval_field(doc.GetField(in_approval_field_name)); PDF::DigitalSignatureField found_approval_signature_digsig_field(found_approval_field);
TimestampingConfiguration tst_config("https://freetsa.org/tsr"); VerificationOptions opts(VerificationOptions::e_compatibility_and_archiving); opts.AddTrustedCertificate("./Certificate V2/cacert.pem"); opts.EnableOnlineCRLRevocationChecking(true);
puts("Testing timestamping configuration.");
const TimestampingResult config_result(found_approval_signature_digsig_field.GenerateContentsWithEmbeddedTimestamp(tst_config, opts));
if (config_result.GetStatus()){ puts("Success: timestamping configuration usable. Attempting to timestamp."); } else{ // Print details of timestamping failure. puts(config_result.GetString().ConvertToUtf8().c_str()); if (config_result.HasResponseVerificationResult()){ EmbeddedTimestampVerificationResult tst_result(config_result.GetResponseVerificationResult()); printf("CMS digest status: %s\n", tst_result.GetCMSDigestStatusAsString().ConvertToUtf8().c_str()); printf("Message digest status: %s\n", tst_result.GetMessageImprintDigestStatusAsString().ConvertToUtf8().c_str()); printf("Trust status: %s\n", tst_result.GetTrustStatusAsString().ConvertToUtf8().c_str()); } } }
int main(int * argc ,char * argv[]) { PDFNet::Initialize(“demo:1633957651957:78a80cae03000000006daebb38099f54ad99b64ef524fca4902e1636bd”);
PDFDoc doc("testClear.pdf"); DigitalSignatureField approval_signature_field = doc.CreateDigitalSignatureField("PDFTronApprovalSig");
Annots::SignatureWidget widgetAnnotApproval = Annots::SignatureWidget::Create(doc, Rect(300, 287, 376, 306), approval_signature_field); Page page1 = doc.GetPage(1); page1.AnnotPushBack(widgetAnnotApproval); doc.Save("waiver_withApprovalField_output.pdf", SDFDoc::e_remove_unused, 0);
SignPDF("waiver_withApprovalField_output.pdf", "PDFTronApprovalSig", "./Certificate V2/GemBoxRSA4096.pfx", "GemBoxPassword", "signature.jpg", "signed.pdf");
}
Use below JavaScript code
const TimestampAndEnableLTV = async (in_docpath, in_trusted_cert_path, in_appearance_img_path, in_outpath) => {
const doc = await PDFNet.PDFDoc.createFromURL(in_docpath);
doc.initSecurityHandler();
doc.lock();
const doctimestamp_signature_field = await doc.createDigitalSignatureField();
const tst_config = await PDFNet.TimestampingConfiguration.createFromURL('http://rfc3161timestamp.globalsign.com/advanced');
const opts = await PDFNet.VerificationOptions.create(PDFNet.VerificationOptions.SecurityLevel.e_compatibility_and_archiving);
/* It is necessary to add to the VerificationOptions a trusted root certificate corresponding to the chain used by the timestamp authority to sign the timestamp token, in order for the timestamp response to be verifiable during DocTimeStamp signing. It is also necessary in the context of this function to do this for the later LTV section, because one needs to be able to verify the DocTimeStamp in order to enable LTV for it, and we re-use the VerificationOptions opts object in that part. */
await opts.addTrustedCertificateFromURL(in_trusted_cert_path);
/* By default, we only check online for revocation of certificates using the newer and lighter OCSP protocol as opposed to CRL, due to lower resource usage and greater reliability. However, it may be necessary to enable online CRL revocation checking in order to verify some timestamps (i.e. those that do not have an OCSP responder URL for all non-trusted certificates). */
await opts.enableOnlineCRLRevocationChecking(true);
const widgetAnnot = await PDFNet.SignatureWidget.createWithDigitalSignatureField(doc, new PDFNet.Rect(0, 100, 200, 150), doctimestamp_signature_field);
await (await doc.getPage(1)).annotPushBack(widgetAnnot);
// (OPTIONAL) Add an appearance to the signature field.
const img = await PDFNet.Image.createFromURL(doc, in_appearance_img_path);
await widgetAnnot.createSignatureAppearance(img);
console.log('Testing timestamping configuration.');
const config_result = await tst_config.testConfiguration(opts);
if (await config_result.getStatus()) {
console.log('Success: timestamping configuration usable. Attempting to timestamp.');
} else {
// Print details of timestamping failure.
console.log(await config_result.getString());
if (await config_result.hasResponseVerificationResult()) {
const tst_result = await config_result.getResponseVerificationResult();
console.log('CMS digest status: ' + (await tst_result.getCMSDigestStatusAsString()));
console.log('Message digest status: ' + (await tst_result.getMessageImprintDigestStatusAsString()));
console.log('Trust status: ' + (await tst_result.getTrustStatusAsString()));
}
return false;
}
await doctimestamp_signature_field.timestampOnNextSave(tst_config, opts);
// Save/signing throws if timestamping fails.
let docbuf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_incremental);
saveBufferAsPDFDoc(docbuf, in_outpath);
console.log('Timestamping successful. Adding LTV information for DocTimeStamp signature.');
// Add LTV information for timestamp signature to document.
const timestamp_verification_result = await doctimestamp_signature_field.verify(opts);
if (!(await doctimestamp_signature_field.enableLTVOfflineVerification(timestamp_verification_result))) {
console.log('Could not enable LTV for DocTimeStamp.');
return false;
}
docbuf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_incremental);
saveBufferAsPDFDoc(docbuf, in_outpath);
console.log('Added LTV information for DocTimeStamp signature successfully.');
return true;
};
I have following this tutorial to setup multiple organizations. According to step 13 before committing transaction requires both organizations should sign off. How can I test that both organizations are endorsing transaction?
Give the proposal responses you are receiving from endorsing peer you can iterate to check validity of the signatures. Here for example code from Java SDK which handles this:
/*
* Verifies that a Proposal response is properly signed. The payload is the
* concatenation of the response payload byte string and the endorsement The
* certificate (public key) is gotten from the Endorsement.Endorser.IdBytes
* field
*
* #param crypto the CryptoPrimitives instance to be used for signing and
* verification
*
* #return true/false depending on result of signature verification
*/
public boolean verify(CryptoSuite crypto) {
if (isVerified()) { // check if this proposalResponse was already verified by client code
return isVerified();
}
if (isInvalid()) {
this.isVerified = false;
}
FabricProposalResponse.Endorsement endorsement = this.proposalResponse.getEndorsement();
ByteString sig = endorsement.getSignature();
try {
Identities.SerializedIdentity endorser = Identities.SerializedIdentity
.parseFrom(endorsement.getEndorser());
ByteString plainText = proposalResponse.getPayload().concat(endorsement.getEndorser());
if (config.extraLogLevel(10)) {
if (null != diagnosticFileDumper) {
StringBuilder sb = new StringBuilder(10000);
sb.append("payload TransactionBuilderbytes in hex: " + DatatypeConverter.printHexBinary(proposalResponse.getPayload().toByteArray()));
sb.append("\n");
sb.append("endorser bytes in hex: "
+ DatatypeConverter.printHexBinary(endorsement.getEndorser().toByteArray()));
sb.append("\n");
sb.append("plainText bytes in hex: " + DatatypeConverter.printHexBinary(plainText.toByteArray()));
logger.trace("payload TransactionBuilderbytes: " +
diagnosticFileDumper.createDiagnosticFile(sb.toString()));
}
}
this.isVerified = crypto.verify(endorser.getIdBytes().toByteArray(), config.getSignatureAlgorithm(),
sig.toByteArray(), plainText.toByteArray()
);
} catch (InvalidProtocolBufferException | CryptoException e) {
logger.error("verify: Cannot retrieve peer identity from ProposalResponse. Error is: " + e.getMessage(), e);
this.isVerified = false;
}
return this.isVerified;
} // verify
Of course you can achive same results with other SDK in pretty similar way.
Can anyone help me to upload image to azure storage using qt/c++
here's my code. it seems to have an error on constructing the headers.*
QByteArray data;
QFile file("Bg.jpg");
if (file.open(QIODevice::ReadOnly))
{
data.append(file.readAll()); //let's read the file
}
QString date = QDateTime::currentDateTime().toString("ddd, d MMM yyyy HH:mm:ss") + " GMT";
QString header = QString("PUT\n\n\n%1\n\n\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-date:%2\nx-ms-version:2013-08-15\n/mycontainer/todate/").arg(data.length()).arg(date);
QString urlUri = "http://myaccount.blob.core.windows.net/mycontainer/todate";
QByteArray ba = header.toUtf8();
unsigned char* signature = reinterpret_cast<unsigned char*>(ba.data());
QByteArray kba =
QByteArray::fromBase64("key");
unsigned char* key = (unsigned char*) kba.data();
unsigned char result[EVP_MAX_MD_SIZE];
unsigned int result_len;
ENGINE_load_builtin_engines();
ENGINE_register_all_complete();
HMAC_CTX ctx;
HMAC_CTX_init(&ctx);
HMAC_Init_ex(&ctx, key, strlen((const char*)key), EVP_sha256(), NULL);
HMAC_Update(&ctx, signature, strlen((const char*)signature));
HMAC_Final(&ctx, result, &result_len);
HMAC_CTX_cleanup(&ctx);
QByteArray array = QByteArray::fromRawData((char*)result, result_len);
array = array.toBase64();
String version = "2013-08-15";
QNetworkAccessManager* manager = new QNetworkAccessManager();
QNetworkRequest request;
request.setUrl(QUrl(urlUri));
request.setRawHeader("Content- Length",QString::number(data.length()).toStdString().c_str());
request.setRawHeader("Content-Type","application/octet-stream");
request.setRawHeader("x-ms-blob-type","BlockBlob");
request.setRawHeader("x-ms-date", date.toStdString().c_str());
request.setRawHeader("x-ms-version", version.toStdString().c_str());
request.setRawHeader("Authorization","SharedKey myaccount:"+array);
manager->post(request,data);
connect(manager, SIGNAL(finished(QNetworkReply*)), this,SLOT(manageCloudReply(QNetworkReply*)));
and this is the response on the request
AuthenticationFailed Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:82eb03cb-adf1-4797-bbc0-86c3e5ca3ec6
Time:2014-03-19T03:52:35.4790761ZThe MAC signature found in the HTTP request '3Dk7laN3XW+ASbQj0XddfmSnnuYfVSkhg/oRfSJekKY=' is not the same as any computed signature. Server used following string to sign: 'POST
87163
application/octet-stream
x-ms-blob-type:BlockBlob
x-ms-date:Wed, 19 Mar 2014 11:52:05 GMT
x-ms-version:2013-08-15
/logboxstorage/mycontainer/todate'.
any help will be appreciated..thanks!!!!
Looking at the following line of code:
QString header = QString("PUT\n\n\n%1\n\n\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-date:%2\nx-ms-version:2013-08-15\n/mycontainer/todate/").arg(data.length()).arg(date);
I see an extra slash (/) in mycontainer/todate/. Can you try by removing that?
Also look at the following code:
QString date = QDateTime::currentDateTime().toString("ddd, d MMM yyyy HH:mm:ss") + " GMT";
currentDateTime() will return the local date/time based on your computer. It should be UTC/GMT date/time. Try using currentDateTimeUtc().
Another thing I noticed is that your request is going as POST to the server. It should be a PUT request.
I have an issue regarding WMI connection through asp.net from Computer A (windows 2003 server) to Computer B (Windows XP)..
The error is as follows:
RPC server is unavailable..
There are a few steps that you must take in order to successfully leverage WMI connectivity. The basics are you must allow remote management on the target box of course. If you can’t RDP into it, chances are, you can’t remote manage anything else. This can also include Windows firewall issues too. Make sure your request can even get in at all.
Next, start simple. Can you even poll for the running processes on that box? Try to output all the running processes on the target box with System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetProcesses("machine-name"). If you can at least get some information on the box then the RPC message you are getting has to do with incorrect arguments being passed in, perhaps?
Anyways, I recently wrote a web application that allowed the users to find a server on the LAN and kill a target process there or start a new one. I did it in C# so the code snippet below is just what I used. It's not the best but its working in production right now:
public static class RemoteProcessAccess
{
public static void KillProcessByProcessID(string NameOfServer, string DomainName, string LogIn, string Password, int processID)
{
//#1 The vars for this static method
#region /// <variables> ...
string userName;
string password;
string machineName;
string myDomain;
Hashtable hs = new Hashtable();
ManagementScope mScope;
ConnectionOptions cnOptions;
ManagementObjectSearcher objSearcher;
ManagementOperationObserver opsObserver;
ManagementClass manageClass;
DirectoryEntry entry;
DirectorySearcher searcher;
DirectorySearcher userSearcher;
#endregion
//#2 Set the basics sent into the method
machineName = NameOfServer;
myDomain = DomainName;
userName = LogIn;
password = Password;
cnOptions = new ConnectionOptions();
cnOptions.Impersonation = ImpersonationLevel.Impersonate;
cnOptions.EnablePrivileges = true;
cnOptions.Username = myDomain + "\\" + userName;
cnOptions.Password = password;
mScope = new ManagementScope(#"\\" + machineName + #"\ROOT\CIMV2", cnOptions);
//#3 Begin Connection to Remote Box
mScope.Connect();
objSearcher = new ManagementObjectSearcher(String.Format("Select * from Win32_Process Where ProcessID = {0}", processID));
opsObserver = new ManagementOperationObserver();
objSearcher.Scope = mScope;
string[] sep = { "\n", "\t" };
//#4 Loop through
foreach (ManagementObject obj in objSearcher.Get())
{
string caption = obj.GetText(TextFormat.Mof);
string[] split = caption.Split(sep, StringSplitOptions.RemoveEmptyEntries);
// Iterate through the splitter
for (int i = 0; i < split.Length; i++)
{
if (split[i].Split('=').Length > 1)
{
string[] procDetails = split[i].Split('=');
procDetails[1] = procDetails[1].Replace(#"""", "");
procDetails[1] = procDetails[1].Replace(';', ' ');
switch (procDetails[0].Trim().ToLower())
{
//You could look for any of the properties here and do something else,
case "processid":
int tmpProc = Convert.ToInt32(procDetails[1].ToString());
//if the process id equals the one passed in....
//(this is redundant since we should have limited the return
//by the query where above, but we're paranoid here
if (tmpProc.Equals(processID))
{
obj.InvokeMethod(opsObserver, "Terminate", null);
}
break;
}//end process ID switch...
}//end our if statement...
}//end our for loop...
}//end our for each loop...
}//end static method
}
Look at KB875605 ("How to troubleshoot WMI-related issues in Windows XP SP2")
You could enable the RPC server on any target machine by running this on the target's command prompt:
[/code]
netsh firewall set service RemoteAdmin
[/code]
Worked for me at least. :)
Try to use wmic command line to get information from the remote computer, also you can install the code of Services+ and try to connect and debug your connection to the server, most likely it is firewall problem or RPC services is down or disabled.