Home > Domino Tips > Developer > LotusScript > Check for encryption key
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Check for encryption key


David Malterre
10.28.2002
Rating: -1.40- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Does a user have a specific encryption key attached to her ID file? Use this script function to find out.

The example displays a dialogbox showing if the current user owns encryption key "SampleKey". This could also be used to send an e-mail report on which users have a given key, or to set field values and display customized content based on whether or not the user owns the encryption key.



Code

'CALLING THE FUNCTION

Sub Click(Source As Button)
     Const keyname = "SampleKey"
     If UserOwnsEncryptionKey(keyname) Then
          Msgbox "Key " & keyname & " is attached to your ID file."
     Else
          Msgbox "Key " & keyname & " is not attached to your ID file."
     End If
End Sub


'FUNCTION ITSELF
%INCLUDE "lserr.lss"
Function UserOwnsEncryptionKey(keyname As String)
     
     'Error 4000 occurs when calling testdoc.Encrypt if the user does not have the key whose name is passed to the function
     On Error 4000 Goto processError
     
     Dim ss As New NotesSession
     Dim db As NotesDatabase
     Dim testdoc As NotesDocument
     Dim item1 As NotesItem
     
     Set db = ss.CurrentDatabase
     Set testdoc = New NotesDocument(db)
     Set item1 = testdoc.AppendItemValue( "Test", "abc" )
     item1.IsEncrypted = True
     testdoc.EncryptionKeys = keyname
     
     Call testdoc.Encrypt
     
     UserOwnsEncryptionKey = True
     Exit Function
     
processError:
     UserOwnsEncryptionKey = False
     Exit Function
End Function

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
LotusScript
LotusScript button saves time searching large Lotus Notes databases
How to clear a Lotus Notes local cache with LotusScript
Create a non-specified date picker with LotusScript code
LotusScript accesses clipboard to view copied Notes documents
LotusScript action button manages Lotus Notes mail files
LotusScript sorts a Lotus Notes document collection
Display Lotus Notes user group membership details in a tree view
Alternate version of @Command forwards subform via LotusScript
Process large arrays in Notes forms without undue coding or testing
How to use LotusScript to modify a Lotus Notes view selection

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts