Ejemplo de permisos de objetos de espacio de nombres para un usuario HSM.
package doxy.examples;
import java.util.concurrent.TimeUnit;
import com.dinamonetworks.Dinamo;
import br.com.trueaccess.TacException;
import br.com.trueaccess.TacNDJavaLib;
public class UserNamespacePermission {
static String ip = "127.0.0.1";
static String operatorId = "master";
static String operatorPwd = "12345678";
static String userId = "user01";
static String userPwd = "12345678";
public static void main(String[] args) throws TacException, InterruptedException {
Dinamo opUserSession = new Dinamo();
int authMask = 0;
opUserSession.openSession(ip, operatorId, operatorPwd, TacNDJavaLib.DEFAULT_PORT, false, false, true);
opUserSession.createUser(userId, userPwd, authMask);
Dinamo userSession = new Dinamo();
String strKeyName = "key";
userSession.openSession(ip,
userId,
userPwd,
TacNDJavaLib.DEFAULT_PORT,
false, false, true);
userSession.createKey( strKeyName,
TacNDJavaLib.ALG_3DES_168,
true);
userSession.updateUserObjPermission(operatorId,
true,
true,
true,
true);
opUserSession.getUserKey(userId+"/"+strKeyName);
userSession.updateUserObjPermission(operatorId,
false,
false,
false,
false);
userSession.closeSession(true);
TimeUnit.SECONDS.sleep(1);
opUserSession.deleteUser(userId);
opUserSession.closeSession();
}
}