我正在z / OS上编写Java代码,我需要找出系统上哪个安全管理器(RACF,ACF2或TopSecret)处于活动状态。我该怎么办?
答案 0 :(得分:5)
您可以使用IBM JZOS软件包如下所示来查看内存。对于生产代码,我将为安全管理器创建一个枚举,而不是传递字符串,而不得不处理字符串比较。
import com.ibm.jzos.ZUtil;
/**
* This is a sample program that uses IBM JZOS to determine
* the Enterprise Security Manager that is active on a z/OS
* system.
* <p>
* @see com.ibm.jzos.ZUtil#peekOSMemory(long, int)
* @see com.ibm.jzos.ZUtil#peekOSMemory(long, byte[])
*/
public class peek {
public static void main(String[] args) throws Exception {
byte[] rcvtIdBytes = new byte[4];
long pPSA = 0L;
int psaOffsetCVT = 16;
long pCVT = ZUtil.peekOSMemory(pPSA + psaOffsetCVT, 4); // Get address of CVT from PSA+16
int cvtOffsetCVTRAC = 0x3e0; // Offset of CVTRAC (@RCVT) in the CVT
long pCVTRAC =
ZUtil.peekOSMemory(pCVT + cvtOffsetCVTRAC, 4); // Get the address of CVTRAC (Mapped by ICHPRCVT)
// Now we can retrieve the 4 byte ID (in IBM-1047) of the active ESM.
int cvtracOffsetRCVTID = 0x45; // Offset of RCVTID in the RCVT
ZUtil.peekOSMemory(pCVTRAC + cvtracOffsetRCVTID, rcvtIdBytes); // Get the RCVTID
String rcvtId = new String(rcvtIdBytes, "IBM-1047");
System.out.println("The Security Manager is: "+rcvtId);
}
}