setUserIDForDecrypt (Database - Java)

After calling this method on a database, any document that is opened within the database is decrypted using the encryption keys within the userID object, as specified in the document SecretEncryptionKeys field.

Defined in

Database

Syntax

public void setUserIDForDecrypt(lotus.domino.UserID uid)
		throws NotesException

public void setUserIDForDecrypt(String idfile, String password)
		throws NotesException
Parameter Description
uid NotesUserID (type). After setting the User id, documents in this database will be decrypted with encryption keys of this user id
idfile String. Provides the file path of id file. After setting it, all documents in this database will be decrypted with encryption keys of this user id and password.
password String. After setting the User id, documents in this database will be decrypted with encryption keys of this user id and password.

Example

This code provides an example of how to use this method:

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();

       
       
       Database db1 = session.getDatabase("TEST", "test1.nsf");
	
       db1.setUserIDFileForDecrypt("c:\\1.id","12345");

       Document doc1 = db1.getAllDocuments().getFirstDocument();

       Vector value1 = doc.getItemValue("item1");

       db1.setUserIDFileForDecrypt("","");
      
    
   
       IDVault id = session.getIDVault();

	 UserID uid = id.getUserID("test vault2/IBM", "12345", "TEST/IBM");

       Database db2 = session.getDatabase("TEST", "test2.nsf");
	
       db2.setUserIDForDecrypt(uid);

       Document doc2 = db2.getAllDocuments().getFirstDocument();
 	   
        Vector value2 = doc2.getItemValue("item2"); 
     
      db2.setUserIDForDecrypt(null);

            
      } catch(Exception e) {
          e.printStackTrace();
       }  
   }
}	Set id = session.getIDVault()
	Set ui = iv.Getuserid("test vault2/IBM", "12345", "TEST/IBM")
	Set db2 = session.getDatabase("TEST", "test2.nsf")
	Call db2.Setuseridfordecrypt(ui)
	Set doc2 = db2.Alldocuments.Getfirstdocument()
	vec2 = doc2.Getitemvalue("item2")	
	Call db2.Setuseridfordecrypt(Nothing)