OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Digital signature

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Jul 31, 2006 7:34 am    Post subject: Digital signature Reply with quote

Signing a Document is explained here :
Just switch! - Secure document exchange with StarOffice 8 http://blogs.sun.com/roller/page/dancer/20050308
as already mentioned in this forum.
It was straightforward to make it working under Windows when using Windows Signature Manager (exactly as explained in the above link)
But under Linux I make it working using the OOo code published here :

Certificate Detection in OOoBasic http://wiki.services.openoffice.org/wiki/Certificate_Detection

Launching this code allows me to retrieve the corresponding FireFox profile.
A corresponding
Code:

export MOZILLA_CERTIFICATE_FOLDER=.....

before launching OOo and it works.
I have begun to write OOoBasic code to explore the corresponding API but it is not sufficiently advanced to be published. Maybe later on...
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed Aug 02, 2006 10:04 am    Post subject: Reply with quote

For completion of previous post you can also find in OpenOffice Wiki, an article on digital signature :
How to use digital Signatures [url]http://wiki.services.openoffice.org/wiki/How_to_use_digital_Signatures [/url]

I am not sure i will use digital signature architecture because I don't really trust it. Under Windows and under Linux when I sign a document the OS doesn't ask me for a password and I don't like that ! That means only user account passwords are protection : if you are logged and not in front of your computer, every body can sign for you. For me it's a weakness (for OS not for OOo).
It would be great if anybody can confirm or infirm that : perhaps my certificate is not good !

Certificate management by OS or Firefox is weak as I said, but what about OOo ? I absolutly don't like management with the MOZILLA_CERTIFICATE_FOLDER environment variable under Linux. Do you know how I manage it at the first time ? I change the script <OOo2.0>/program/soffice to export this variable. This was the weaker thing I can do ! Now everybody with an account on my computer can sign for me !!! Of course I can manage it an other way but it's the first idea I have and I don't see why other could not have the same idea.

I have written code in OOoBAsic but I never obtain the certificate with this code and I don't know why. Because I don't want to go further with this API I give this code :

Code:

Sub DigitalSign
  oDocumentDigitalSignatures = createUnoService( "com.sun.star.security.DocumentDigitalSignatures" )
 
  print oDocumentDigitalSignatures.getDocumentContentSignatureDefaultStreamName
  'prints out : documentsignatures.xml
   
  print oDocumentDigitalSignatures.getScriptingContentSignatureDefaultStreamName
  'prints out : macrosignatures.xml
 
  print oDocumentDigitalSignatures.getPackageSignatureDefaultStreamName
  'prints out : packagesignatures.xml
 
  Dim  xXMLSecurityContext as object
  xXMLSecurityContext = createUnoService( "com.sun.star.xml.crypto.XMLSecurityContext" )
  'WritedbgInfo( oDocumentDigitalSignatures)
  Dim Env    as object
  'Doesn't work : Env =  xXMLSecurityContext. getSecurityEnvironment
 
  print  xXMLSecurityContext.getImplementationName
  'prints out com.sun.star.xml.security.bridge.xmlsec.XMLSecurityContext_MSCryptImpl under Windows
   'prints out com.sun.star.xml.security.bridge.xmlsec.XMLSecurityContext_NssImpl under Linux
  Dim xSecurityEnvironment as Object
  xSecurityEnvironment = createUnoService( "com.sun.star.xml.crypto.SecurityEnvironment" )
 
  print xSecurityEnvironment.getSecurityEnvironmentInformation
  'prints out Microsoft Crypto API
  'prints out Unknown Token under Linux !
 
  Dim i as Integer
  'Dim  asObject
  Dim Certificates() as Object
   Certificates() = xSecurityEnvironment.getPersonalCertificates()
   print   Lbound(Certificates()
        'prints out 0 means O certificate !
   'For i = 0 To lbound(Certificates())
   Dim Certificat as Object
   Certificat=Certificates(0)
  'WritedbgInfo(xXMLSecurityContext)
End sub


_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group