Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
6e65df9a
Kaydet (Commit)
6e65df9a
authored
May 18, 2005
tarafından
Rüdiger Timm
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
INTEGRATION: CWS xmlsec12 (1.4.6); FILE MERGED
2005/04/13 10:14:49 mt 1.4.6.1: Clean-Ups...
üst
e1956188
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
77 deletions
+20
-77
verifydemo.cxx
xmlsecurity/tools/demo/verifydemo.cxx
+20
-77
No files found.
xmlsecurity/tools/demo/verifydemo.cxx
Dosyayı görüntüle @
6e65df9a
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: verifydemo.cxx,v $
* $RCSfile: verifydemo.cxx,v $
*
*
* $Revision: 1.
4
$
* $Revision: 1.
5
$
*
*
* last change: $Author: rt $ $Date: 2005-0
3-29 13:28:31
$
* last change: $Author: rt $ $Date: 2005-0
5-18 10:03:28
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -59,77 +59,45 @@
...
@@ -59,77 +59,45 @@
*
*
************************************************************************/
************************************************************************/
#include <stdio.h>
#include "util.hxx"
#include "util.hxx"
#include <
rtl/ustring.hxx
>
#include <
stdio.h
>
#include <cppuhelper/servicefactory.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <unotools/streamhelper.hxx>
//CP : added by CP
#include <rtl/locale.h>
#include <osl/nlsupport.h>
#ifndef _OSL_PROCESS_H_
#include <osl/process.h>
#endif
//CP : end
#include <xmlsecurity/xmlsignaturehelper.hxx>
namespace
cssu
=
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
;
namespace
cssl
=
com
::
sun
::
star
::
lang
;
namespace
cssxc
=
com
::
sun
::
star
::
xml
::
crypto
;
namespace
cssi
=
com
::
sun
::
star
::
io
;
long
startVerifyHandler
(
void
*
,
void
*
)
long
startVerifyHandler
(
void
*
,
void
*
)
{
{
char
answer
;
return
QueryVerifySignature
();
fprintf
(
stdout
,
"A signature is found, whether to verify it(y/n)?[y]:"
);
fscanf
(
stdin
,
"%c"
,
&
answer
);
return
(
answer
==
'n'
)
?
0
:
1
;
}
}
int
SAL_CALL
main
(
int
argc
,
char
**
argv
)
int
SAL_CALL
main
(
int
argc
,
char
**
argv
)
{
{
if
(
argc
!=
4
)
if
(
argc
<
2
)
{
{
fprintf
(
stderr
,
"Usage: %s <
rdb file> <signature file> <cryptoken>
\n
"
,
argv
[
0
]
)
;
fprintf
(
stderr
,
"Usage: %s <
signature file> [<cryptoken>]
\n
"
,
argv
[
0
]
)
;
return
-
1
;
return
-
1
;
}
}
/*
rtl
::
OUString
aSIGFileName
=
rtl
::
OUString
::
createFromAscii
(
argv
[
1
]);
* creates a component factory from local rdb file.
rtl
::
OUString
aCryptoToken
;
*/
if
(
argc
>=
3
)
cssu
::
Reference
<
cssl
::
XMultiServiceFactory
>
xManager
=
NULL
;
aCryptoToken
=
rtl
::
OUString
::
createFromAscii
(
argv
[
2
]);
cssu
::
Reference
<
cssu
::
XComponentContext
>
xContext
=
NULL
;
try
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xMSF
=
CreateDemoServiceFactory
();
{
xManager
=
serviceManager
(
xContext
,
rtl
::
OUString
::
createFromAscii
(
"local"
),
rtl
::
OUString
::
createFromAscii
(
argv
[
1
]
)
)
;
OSL_ENSURE
(
xManager
.
is
()
,
"ServicesManager - "
"Cannot get service manager"
);
fprintf
(
stdout
,
"xManager created.
\n
"
)
;
}
catch
(
cssu
::
Exception
&
e
)
{
fprintf
(
stderr
,
"Error Message: %s
\n
"
,
rtl
::
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_ASCII_US
).
getStr
()
)
;
return
-
1
;
}
/*
/*
* creates a signature helper
* creates a signature helper
*/
*/
XMLSignatureHelper
aSignatureHelper
(
xM
anager
);
XMLSignatureHelper
aSignatureHelper
(
xM
SF
);
/*
/*
* creates a security context.
* creates a security context.
*/
*/
bool
bInit
=
aSignatureHelper
.
Init
(
rtl
::
OUString
::
createFromAscii
(
argv
[
3
])
);
bool
bInit
=
aSignatureHelper
.
Init
(
aCryptoToken
);
if
(
!
bInit
)
if
(
!
bInit
)
{
{
fprintf
(
stderr
,
"Error initializing security context!"
);
fprintf
(
stderr
,
"Error initializing security context!"
);
...
@@ -143,24 +111,10 @@ int SAL_CALL main( int argc, char **argv )
...
@@ -143,24 +111,10 @@ int SAL_CALL main( int argc, char **argv )
aSignatureHelper
.
StartMission
();
aSignatureHelper
.
StartMission
();
/*
* prepares the signature stream.
*/
rtl
::
OUString
aSIGFileName
=
rtl
::
OUString
::
createFromAscii
(
argv
[
2
]);
SvFileStream
*
pStream
=
new
SvFileStream
(
aSIGFileName
,
STREAM_READ
);
pStream
->
Seek
(
STREAM_SEEK_TO_END
);
ULONG
nBytes
=
pStream
->
Tell
();
pStream
->
Seek
(
STREAM_SEEK_TO_BEGIN
);
SvLockBytesRef
xLockBytes
=
new
SvLockBytes
(
pStream
,
TRUE
);
/*
* creates the signature stream.
*/
cssu
::
Reference
<
cssi
::
XInputStream
>
xInputStream
=
new
utl
::
OInputStreamHelper
(
xLockBytes
,
nBytes
);
/*
/*
* verifies the signature
* verifies the signature
*/
*/
uno
::
Reference
<
io
::
XInputStream
>
xInputStream
=
OpenInputStream
(
aSIGFileName
);
bool
bDone
=
aSignatureHelper
.
ReadAndVerifySignature
(
xInputStream
);
bool
bDone
=
aSignatureHelper
.
ReadAndVerifySignature
(
xInputStream
);
/*
/*
...
@@ -170,27 +124,16 @@ int SAL_CALL main( int argc, char **argv )
...
@@ -170,27 +124,16 @@ int SAL_CALL main( int argc, char **argv )
if
(
!
bDone
)
if
(
!
bDone
)
{
{
fprintf
(
stderr
,
"
Error in
Signature!
\n
"
);
fprintf
(
stderr
,
"
\n
STATUS: Error verifying
Signature!
\n
"
);
}
}
else
else
{
{
fprintf
(
stdout
,
"
Signatures verified without any problems
!
\n
"
);
fprintf
(
stdout
,
"
\n
STATUS: All choosen Signatures veryfied successfully
!
\n
"
);
}
}
aSignatureHelper
.
EndMission
();
aSignatureHelper
.
EndMission
();
// By CP , for correct encoding
QueryPrintSignatureDetails
(
aSignatureHelper
.
GetSignatureInformations
(),
aSignatureHelper
.
GetSecurityEnvironment
()
);
sal_uInt16
encoding
;
rtl_Locale
*
pLocale
=
NULL
;
osl_getProcessLocale
(
&
pLocale
)
;
encoding
=
osl_getTextEncodingFromLocale
(
pLocale
)
;
// CP end
fprintf
(
stdout
,
"------------- Signature details -------------
\n
"
);
fprintf
(
stdout
,
"%s"
,
rtl
::
OUStringToOString
(
getSignatureInformations
(
aSignatureHelper
.
GetSignatureInformations
(),
aSignatureHelper
.
GetSecurityEnvironment
()),
encoding
).
getStr
());
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment