Solved

DES encryption via Lotusscript or Java  web Agent

Posted on 2002-05-19
14
1,185 Views
Last Modified: 2013-12-18
The problem:
A Web agent needs to DES encode 2 variables obtained from lotus db and and append them to a URL.
Eg. my site www.example.com
somebody logs in, i get certain info from the lotus db based on their login info (REMOTE_USER)(can do this part)and want to present a link to the user that has those two values DES encoded.

Eg:
http://www.somewhereelse.com?value1=[encryptedValue1]&value2=[encryptedvalue2]

The other site will then decode the values and use them appropriately.

Does anyone know or preferably have code that is domino compatible? The Agent can be written in either Lotusscript or Java. All i need is the code that encrypts a variable using DES, i can do the rest.
Sun has a Java library to do this but i'm not sure how to make this work on an agent.
Lots of points on offer, will award BONUS points if a whole AGENT that does this is provided. BONUS points dependant on how much work the Agent saves me.
0
Comment
Question by:HRT_HSV
  • 7
  • 5
  • 2
14 Comments
 
LVL 10

Accepted Solution

by:
zvonko earned 350 total points
ID: 7021507
OK, I catch your word "All i need is the code that encrypts a variable using DES, i can do the rest."

Here it goes.

Doing it in Java is multy complicated because you have several layers (service providers) and version dependencies (Domino agents base on 1.1.8) so it get to difficult.
Much easier it is on LotusScript side but only for OLE/COM platforms (Windows :-) There you can use Microsoft CAPICOM distribution.
Download and register first this CAPICOM.dll form here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/getting_ready_to_use_capicom.asp
http://www.microsoft.com/downloads/release.asp?releaseid=30316

Please not that CCRINST.exe is a cabinet containing CAPICOM.dll
I have moved mine to: C:\WINDOWS\system32\CAPICOM.dll
And registered with:
regsvr32 C:\WINDOWS\system32\CAPICOM.dll

When you have registered this then is encoding with DES done like this:
Const CAPICOM_ENCRYPTION_ALGORITHM_RC2 = 0
Const CAPICOM_ENCRYPTION_ALGORITHM_RC4 = 1
Const CAPICOM_ENCRYPTION_ALGORITHM_DES = 2
Const CAPICOM_ENCRYPTION_ALGORITHM_3DES  = 3

Const CAPICOM_ENCODE_BASE64 = 0
Const CAPICOM_ENCODE_BINARY = 1

Const CAPICOM_SECRET_PASSWORD = 0

Sub Initialize
  Dim crypto As String
 
  Msgbox "Test"
  crypto = EncryptMessage("Test", "topsecret")
  Msgbox ">: " & crypto
End Sub
Function EncryptMessage(Byval TobeEncrypted As String, Byval hidden As String) As String
  Dim message As Variant
  On Error Goto errorhandler  
' Declare and initialize an EncryptedData object.
  Set message = CreateObject( "CAPICOM.EncryptedData" )
  Call message.SetSecret(hidden, CAPICOM_SECRET_PASSWORD)
  message.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM_DES
  message.Content = Tobeencrypted
'Declare the string that will hold the encrypted message.
  Dim encryptedmessage As String
'Encrypt the message storing the result in the encryptedmessage string
  encryptedmessage = message.Encrypt(CAPICOM_ENCODE_BASE64)
' Optionally, check the length of the encrypted string to make sure that the
' encrypt method worked.
  If Len(encryptedmessage) < 1 Then
    Msgbox "no message encrypted. "
  Else
    Msgbox " Message is " & Len(encryptedmessage) & " characters"
    EncryptMessage = encryptedmessage
  End If
' Release the EncryptedData object.
  Set message = Nothing
  Exit Function
ErrorHandler:
  If Err > 0 Then
    Msgbox "Error in Line: " & Erl & "; Msg: " & Error
  Else
    Msgbox "CAPICOM error found : " & Err
  End If
  Exit Function
End Function


Any questions?

PS: my upper code is derived from Microsoft CAPICOM example found in upper URLs and tested by me to encrypt (and decrypt :-) correctly.

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7022239
Guess you will get to the 100k Mark before me for sure at this rate Zvo !

;-)
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7022767
I hope so :-)
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 9

Expert Comment

by:Arunkumar
ID: 7022908
Well...Good Luck!
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7025487
Hello HRT_HSV,

any progress with this?
Do you need more details?


0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7025659
Did you see the game by Moon and JM ???
0
 

Author Comment

by:HRT_HSV
ID: 7025766
Ok thank you for the response.
I will give that a try asap and award you the points if it works.

I am willing to award more points if anyone can provide a non-windows solution also. The windows solution is sufficient for now but solution may need to be ported to a different platform in the not so distant future.
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7027091
Hello,

I know what you are searching for, but this is not so easy: you like to see DES encryption in source code, right?

This does not serve that much. It is a lot of xor and shift operations you have no chance to understand so you can use a DLL or even better a command line tool to pass a string and get encrypted value back. So you can call this tool in LotusScript shell() function to get the encryption.

What platform you will be asking for this non Windows tool?

Or do you prefer Java? If you would use Java you will get only disadvantages. You have to care about encryption service provider classes and Java version dependencies. There is no advantage of portability.

0
 
LVL 10

Expert Comment

by:zvonko
ID: 7028473
0
 

Author Comment

by:HRT_HSV
ID: 7031189
Thanks zvonko, this code will come in handy.

I understand totally what you mean about a Java solution, it's not within my control though so i may eventually have to port this solution to Java.

Thanks again
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7031365
Thank you for the points and for the feedback :-)

Good luck,
zvonko

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7031418
Hey Buddy !

Good Show!  See you soon beyond 100k !

:-)
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7031656
but not when biggies are graded with an B :(

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7031667
oh yea i too saw that....poor you!

:-(
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question