summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMichael Mi <mmi@openoffice.org>2004-08-12 01:30:19 +0000
committerMichael Mi <mmi@openoffice.org>2004-08-12 01:30:19 +0000
commite076405184f59773a63c44075097e113b17ae9c0 (patch)
tree532ea32dd9e1095f56f03738b10b9383f5a6b822 /xmlsecurity
parent690e909ef771703ef848cda41df753d3f96491b0 (diff)
change datetime format
Issue number: Submitted by: Reviewed by:
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/xmlsecurity/sigstruct.hxx15
-rw-r--r--xmlsecurity/tools/demo/util.cxx61
2 files changed, 70 insertions, 6 deletions
diff --git a/xmlsecurity/inc/xmlsecurity/sigstruct.hxx b/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
index 65da1818c0dc..908595e1a838 100644
--- a/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
+++ b/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sigstruct.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mmi $ $Date: 2004-07-15 08:12:08 $
+ * last change: $Author: mmi $ $Date: 2004-08-12 02:29:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,10 @@
#include <rtl/ustring.hxx>
+#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
+#include <com/sun/star/util/DateTime.hpp>
+#endif
+
#ifndef INCLUDED_VECTOR
#include <vector>
#define INCLUDED_VECTOR
@@ -109,8 +113,11 @@ struct SignatureInformation
rtl::OUString ouX509SerialNumber;
rtl::OUString ouX509Certificate;
rtl::OUString ouSignatureValue;
- rtl::OUString ouDate;
- rtl::OUString ouTime;
+
+ //rtl::OUString ouDate;
+ //rtl::OUString ouTime;
+ ::com::sun::star::util::DateTime stDateTime;
+
rtl::OUString ouSignatureId;
rtl::OUString ouPropertyId;
diff --git a/xmlsecurity/tools/demo/util.cxx b/xmlsecurity/tools/demo/util.cxx
index 42527e0adb0f..c2f827bfc7aa 100644
--- a/xmlsecurity/tools/demo/util.cxx
+++ b/xmlsecurity/tools/demo/util.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: util.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mt $ $Date: 2004-07-26 07:29:34 $
+ * last change: $Author: mmi $ $Date: 2004-08-12 02:30:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,9 +65,57 @@
#include <cppuhelper/bootstrap.hxx>
#include <xmlsecurity/biginteger.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
namespace cssu = com::sun::star::uno;
namespace cssl = com::sun::star::lang;
+/** convert util::DateTime to ISO Date String */
+void convertDateTime( ::rtl::OUStringBuffer& rBuffer,
+ const com::sun::star::util::DateTime& rDateTime )
+{
+ String aString( String::CreateFromInt32( rDateTime.Year ) );
+ aString += '-';
+ if( rDateTime.Month < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Month );
+ aString += '-';
+ if( rDateTime.Day < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Day );
+
+ if( rDateTime.Seconds != 0 ||
+ rDateTime.Minutes != 0 ||
+ rDateTime.Hours != 0 )
+ {
+ aString += 'T';
+ if( rDateTime.Hours < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Hours );
+ aString += ':';
+ if( rDateTime.Minutes < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Minutes );
+ aString += ':';
+ if( rDateTime.Seconds < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Seconds );
+ if ( rDateTime.HundredthSeconds > 0)
+ {
+ aString += ',';
+ if (rDateTime.HundredthSeconds < 10)
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.HundredthSeconds );
+ }
+ }
+
+ rBuffer.append( aString );
+}
+
::rtl::OUString printHexString(cssu::Sequence< sal_Int8 > data)
{
int length = data.getLength();
@@ -175,6 +223,14 @@ cssu::Reference< cssl::XMultiServiceFactory > serviceManager(
result += rtl::OUString::createFromAscii( "\n" );
}
+ result += rtl::OUString::createFromAscii( "--Date :\n" );
+
+ ::rtl::OUStringBuffer buffer;
+ convertDateTime( buffer, infor.stDateTime );
+ result += buffer.makeStringAndClear();
+ result += rtl::OUString::createFromAscii( "\n" );
+
+ /*
if (infor.ouDate.getLength()>0)
{
result += rtl::OUString::createFromAscii( "--Date :\n" );
@@ -188,6 +244,7 @@ cssu::Reference< cssl::XMultiServiceFactory > serviceManager(
result += infor.ouTime;
result += rtl::OUString::createFromAscii( "\n" );
}
+ */
if (infor.ouX509IssuerName.getLength()>0 && infor.ouX509SerialNumber.getLength()>0 && xSecurityEnvironment.is())
{