Solved

DES encryption via Lotusscript or Java  web Agent

Posted on 2002-05-19
14
1,175 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
Comment Utility
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
Comment Utility
Guess you will get to the 100k Mark before me for sure at this rate Zvo !

;-)
0
 
LVL 10

Expert Comment

by:zvonko
Comment Utility
I hope so :-)
0
 
LVL 9

Expert Comment

by:Arunkumar
Comment Utility
Well...Good Luck!
0
 
LVL 10

Expert Comment

by:zvonko
Comment Utility
Hello HRT_HSV,

any progress with this?
Do you need more details?


0
 
LVL 9

Expert Comment

by:Arunkumar
Comment Utility
Did you see the game by Moon and JM ???
0
 

Author Comment

by:HRT_HSV
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 10

Expert Comment

by:zvonko
Comment Utility
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
Comment Utility
0
 

Author Comment

by:HRT_HSV
Comment Utility
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
Comment Utility
Thank you for the points and for the feedback :-)

Good luck,
zvonko

0
 
LVL 9

Expert Comment

by:Arunkumar
Comment Utility
Hey Buddy !

Good Show!  See you soon beyond 100k !

:-)
0
 
LVL 10

Expert Comment

by:zvonko
Comment Utility
but not when biggies are graded with an B :(

0
 
LVL 9

Expert Comment

by:Arunkumar
Comment Utility
oh yea i too saw that....poor you!

:-(
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now