许可证

Inheritance: java.lang.Object

public class License

提供对组件进行授权的方法。

在此示例中,将尝试在包含组件的文件夹、包含调用程序集的文件夹、入口程序集的文件夹中查找名为 MyLicense.lic 的许可证文件,然后在调用程序集的嵌入资源中查找。

License license = new License(); license.setLicense(“MyLicense.lic”);

构造函数

构造函数描述
License()初始化此类的新实例。

方法

方法描述
equals(Object arg0)
getClass()
hashCode()
isInternalFIPSSecurity()默认情况下我们使用默认的 jdk 安全。
notify()
notifyAll()
setInternalFIPSSecurity(boolean internalFIPSSecurity)默认情况下我们使用默认的 jre 安全。
setLicense(InputStream stream)对组件进行授权。
setLicense(String licenseName)对组件进行授权。
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

License()

public License()

初始化此类的新实例。

在此示例中,将尝试在包含组件的文件夹、包含调用程序集的文件夹、入口程序集的文件夹中查找名为 MyLicense.lic 的许可证文件,然后在调用程序集的嵌入资源中查找。

License license = new License(); license.setLicense(“MyLicense.lic”);

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

参数类型描述
arg0java.lang.Object

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

hashCode()

public native int hashCode()

Returns: int

isInternalFIPSSecurity()

public static boolean isInternalFIPSSecurity()

默认情况下我们使用默认的 jdk 安全。默认值 == false。在某些情况下,自定义的 java 环境无法支持所需的算法,因此我们可以建议使用内部内置的 FIPS 安全。

Returns: boolean - 布尔值

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setInternalFIPSSecurity(boolean internalFIPSSecurity)

public static void setInternalFIPSSecurity(boolean internalFIPSSecurity)

默认情况下我们使用默认的 jre 安全。默认值 == false。在某些情况下,自定义的 java 环境无法支持所需的算法,因此我们可以建议使用内部内置的 FIPS 安全。

另请注意:根据 JVM SecureRandom 算法,在某些操作系统上 /dev/random 会等待在主机上生成一定量的 \u201cnoise\u201d 后才返回结果。Oracle\u2019s JVM 中用于随机数生成的库默认在 UNIX 平台上依赖 /dev/random。虽然 /dev/random 更安全,但如果默认 JVM 配置导致延迟,建议使用 /dev/urandom,或添加生成 /dev/random 熵的设备。

以下 java 选项可以帮助避免延迟并覆盖 securerandom.source 设置。-Djava.security.egd=file:/dev/./urandom

Parameters:

参数类型描述
internalFIPSSecurityboolean布尔值

setLicense(InputStream stream)

public void setLicense(InputStream stream)

对组件进行授权。

包含许可证的流。

使用此方法从流中加载许可证。

License license = new License(); license.setLicense(myStream);

Parameters:

参数类型描述
java.io.InputStreamlicense 流

setLicense(String licenseName)

public void setLicense(String licenseName)

对组件进行授权。

尝试在以下位置查找许可证:

  1. 明确路径。

  2. 组件 jar 文件的文件夹。

在此示例中,将尝试在包含组件的文件夹、包含调用程序集的文件夹、入口程序集的文件夹中查找名为 MyLicense.lic 的许可证文件,然后在调用程序集的嵌入资源中查找。

License license = new License(); license.setLicense(“MyLicense.lic”);

Parameters:

参数类型描述
licenseNamejava.lang.String可以是完整或简短的文件名,或嵌入资源的名称。使用空字符串切换到评估模式。

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

参数类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

参数类型描述
arg0long
arg1int