|
As long as you use the Bouncy Castle library you will be ok.
|
|
|
|
|
Ok, I am sorry.
What it is basically doing is:
(1) taking an input XML file, and extracting just the <Body></Body> node structure, we'll call this the 'nodeBody'.
(2) With the 'nodeBody', it then checks if there is a <IRMark></IRMark> node within it, if there is it deletes the <IRMark></IRMark> node from the 'nodeBody'.
(3) With the resultant 'nodeBody' node it does a C14N Transform, the result of which, we'll call the 'result'.
(4) The 'result' is then passed through to a SHA1 hash algorithm, the result of which we'll call the 'digest'; (a byte[] of size == 20 bytes).
(5) The 'digest' is then converted into a Base64 string, the result of which we'll call the 'IRMark'.
I am ok with (1), (2), (4) and (5) above. BUT I would appreciate PLEASE PLEASE how on earth to do a C14N Transform in MFC C++ (unmanaged).
In C# I can do this as follows, but I am not allowed to use .NET in the project I am working on:
/**************************************
* Get the <bod></body> part of the xml:
* ************************************/
XmlDocument doc = new XmlDocument();
doc.PreserveWhitespace = false;
doc.LoadXml(xml);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("env", "http://www.govtalk.gov.uk/CM/envelope");
nsmgr.AddNamespace("ctf", "http://www.govtalk.gov.uk/taxation/CTF");
XmlNode node = doc.SelectSingleNode("//env:GovTalkMessage/env:Body", nsmgr);
doc = new XmlDocument();
doc.PreserveWhitespace = true;
doc.LoadXml(node.OuterXml);
nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("env", "http://www.govtalk.gov.uk/CM/envelope");
nsmgr.AddNamespace("ctf", "http://www.govtalk.gov.uk/taxation/CTF");
node = doc.SelectSingleNode("env:Body/ctf:IRenvelope/ctf:IRheader/ctf:IRmark", nsmgr);
/**************************************
* Remove <IRMark> node
* ************************************/
if (node != null)
{
XmlNode nodeIRMark = node.ParentNode;
nodeIRMark.RemoveChild(node);
}
/**************************************
* Transform the body:
* ************************************/
XmlDsigC14NTransform c14n = new XmlDsigC14NTransform(true);
c14n.LoadInput(doc);
c14n.Algorithm = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
Stream stream = (Stream)c14n.GetOutput(typeof(Stream));
|
|
|
|
|
If you are looking for a XML parsing library, you can take a look at tinyXML[^]
|
|
|
|
|
Thanks. I'll investigate that tomorrow.
|
|
|
|
|
How to get local time in seconds?
I am using MS Visual Studio 2005.
I could get UTC time in seconds below.
Are they correct?
Thanks!
#include <time.h>
#include <sys timeb.h="">
double Clock::getUtcSeconds()const // returns UTC time in second
{
time_t UtcTimeValue;
return time(&UtcTimeValue);
}
string Clock::getUtcHMSTime()const
{
char buffer[10];
string strUtcTime;
time_t UtcTimeValue;
time(&UtcTimeValue);
struct tm* UtcTime = gmtime(&UtcTimeValue); //convert the calender time to UTC time
strUtcTime+=itoa(UtcTime->tm_hour, buffer,10); //convert to decimal number
strUtcTime+=" : ";
strUtcTime+=itoa(UtcTime->tm_min, buffer,10);
strUtcTime+=" : ";
strUtcTime+=itoa(UtcTime->tm_sec, buffer,10);
return strUtcTime;
}
Yonggoo
|
|
|
|
|
|
We want to keep our system cross-platform.
Any ANSI standard way to get local time in seconds?
Yonggoo
|
|
|
|
|
Yonggoo wrote: Any ANSI standard way to get local time in seconds?
To bad you didn't include that requirement in your first post I might not have wasted my time giving you an answer that you can't use.
led mike
|
|
|
|
|
|
I have tried many ways.
The following worked.
double Clock::getLocalSeconds()const // The local time is hours behind. All else are the sams as UTC time.
{
time_t UtcTimeValue;
time(&UtcTimeValue); //get the system time, which is UTC time
struct tm* UtcHMS= gmtime(&UtcTimeValue); //convert it to struct tm*, which is UTC time
int utcHours = UtcHMS->tm_hour;
time_t LocalTimeValue;
time(&LocalTimeValue); //get the system time, which is UTC time
struct tm* LocalHMS = localtime(&LocalTimeValue); //convert it to struct tm*, which is the local time
int localHours = LocalHMS->tm_hour;
double diffHours =utcHours - localHours;
return ((double)UtcTimeValue - diffHours*SECONDS_IN_HOUR);
}
Yonggoo
|
|
|
|
|
Yonggoo wrote: I could get UTC time in seconds below.
Are they correct?
Have you tried it?
Good luck on January 18, 2038
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Yonggoo wrote: Are they correct?
You are in the best position to determine that.
Yonggoo wrote: strUtcTime+=" : ";
You are making an assumption here that a colon is always the separator.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi guys i'm just now learning windows programming and need to learn how to change the size of the window dynamically.Please help me with this guys ....I need it urgently guys.
|
|
|
|
|
How about MoveWindow() or SetWindowPos() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
thanks a lot friend but i asked how to change the size and not to move it.
|
|
|
|
|
rschocks wrote: ...i asked how to change the size...
And I provided you with the names of two functions to do just that.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
K thanks a lot.I will try it.
|
|
|
|
|
if you see MSDN it writes:"changes the position and dimensions of the specified window" and also you can retrives current position of a window if you need
|
|
|
|
|
rschocks wrote: Hi guys i'm just now learning windows programming
Great, it can be a lot of fun. Here is a "tip"... they hide all that information in the DOCUMENTATION[^] so that really beyond breathing the only qualification you need to be a windows developer is READING.
led mike
|
|
|
|
|
Hi,
I am looking for information on how to retrieve a drive's drive letter given the drive's device path (eg: \\?\ide#diskibm-dtla-307030_________________________tx4oa50c#5&230d196c&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}. I get the device path by registering for device notifications for the GUID_DEVINTERFACE_DISK class and processing the DEV_BROADCAST_DEVICEINTERFACE structure received as part of the notifications.
I tried to do this by matching the device type and device number retrieved by sending IOCTL_STORAGE_GET_DEVICE_NUMBER to all drives on the system, but this method seems to fail if there is a RAM drive on the system. I get multiple drives with the same device type and number. Is this expected behaviour?
Is there a more reliable and simpler way to do this? Any help is greatly appreciated.
Thanks,
Priya
|
|
|
|
|
how to configure ip address through netsh from mfc. i used shell execute but it doesnt work
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Is it me or netsh is the flavour of the month ? seems that it's a really popular.
|
|
|
|
|
Maximilien wrote: seems that it's a really popular.
Same person.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i am having a tabcontrol in a dialog. how to close this dialog. some process will be going on behind this dialog. hence i ahve to close this dilaog only.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Modal or modeless? MFC or no?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|