How to Sign J2ME MIDlet

MIDlet签名流程
本文介绍了MIDlet签名过程的三个主要步骤:生成公私钥对、创建证书签名请求并提交给证书颁发机构、使用证书签署MIDlet。此外还详细说明了所需的软件环境及具体操作命令。

from http://m-shaheen.blogspot.com/2009/07/1.html

 

MIDlet Signing process steps can be summarized into :

1. Generate public/private key pairs.

2. Generate Certificate Signing Request (CSR) and submit it to CA .

3. Sign the MIDLet with the certificate.

Software requirements

1. Sun java 2 SDK or JRE

2. Sun Wireless Tool Kit (WTK)

The steps are:

1. Generate public/private key pairs

a. Create a Keystore:

From command line Navigate to java 2 SDK bin directory and type the below command :

keytool -genkey -keyalg rsa -keystore <keystore_filename> -alias <alias_name>

it prompts you to enter a password for your keystore, your name, organization, and address.

b. List the generated keypairs 

To see your generated keypairs entry ,type the below command :

keytool -keystore <keystore_filename> -list


2. Generate Certificate Signing Request (CSR) and submit it to CA :

You need to generate a (CSR) for the enrollment process.

a. generate CSR

Type the below command to create a CSR for the key pair in the keystore:

keytool –certreq –file <certreq_filename.csr> –keystore <keystore_filename> -alias <alias_name>

b. submit the generated CSR to CA 

3. Sign the MIDLet with the certificate:

Once the CA has approved your request, you will receive the certificate, the steps are:

a. Import the certificate to your Keystore

Use the below command

keytool –import –trustcacerts –keystore <keystore_filename> -alias <alias_name> -file <cert_filename>

b. Sign the JAD file

Use JadTool utility to signs a JAR file by adding both of the certificate and the JAR file’s digital signature to the Java Application Descriptor (JAD) file, the process will be :

b.a. Adding the certificate to JAD

use JadTool.jar tadd the certificate as the value of an attribute named MIDlet-Certificate-m-n, where m is the number of the certificate chain, and n is an integer that, for new certificates, begins at one and increments by one each time you add a new certificate to the JAD file.

Java -jar %WTK_HOME%\bin\JadTool.jar -addcert -keystore <keystorename> -alias <aliasname> -storepass <password> -inputjad <input_jadfile> -outputjad <output_jadfile>

You should see the below attributes added to your output jad file

MIDlet-Certificate-1-1,MIDlet-Certificate-1-2,MIDlet-Certificate-1-3

b.b. Adding JAR’s digital signature to the JAD

Gets the JAR’ digital signature, stores it as the value of the MIDlet-Jar-RSA-SHA1 attribute of the output JAD file.

java -jar %WTK_HOME%\bin\jadtool.jar -addjarsig -jarfile <jar_file> -keystore <keystorename> -alias <aliasname> -storepass <password> -keypass <password> -inputjad <input_jadfile> -outputjad <output_jadfile>

Where The default value for -jarfile is the MIDlet-Jar-URL property in the JAD file.

References:

https://knowledge.verisign.com/support/ssl-certificates-support/index?page=content&id=AR185

https://knowledge.verisign.com/support/ssl-certificates-support/index?page=content&id=SO8381

http://java.sun.com/products/sjwtoolkit/wtk2.5.2/docs/UserGuide-html/commandline.html

http://java.sun.com/j2se/1.4/docs/tooldocs/win32/keytool.html

http://java.sun.com/javame/reference/docs/sjwc-2.2/pdf-html/html/tools/jadtool.html

### TensorFlow 环境部署常见问题及解决方案 在部署 TensorFlow 环境时,可能会遇到一系列常见的问题。以下是这些问题的详细描述及其对应的解决方案。 #### 1. 缺少必要的依赖项 在 Linux 系统上编译 TensorFlow 时,如果缺少必要的依赖项,会导致编译失败。例如,某些系统库或开发工具未正确安装[^1]。 - **解决方法**:确保所有必需的依赖项已安装。可以通过运行以下命令来安装基本依赖项: ```bash sudo apt-get update sudo apt-get install -y build-essential git python3-dev python3-pip ``` #### 2. TensorFlow 版本与 Python 版本不匹配 TensorFlow 的不同版本可能需要特定的 Python 版本支持。如果 Python 版本不符合要求,可能导致安装失败或运行时错误[^2]。 - **解决方法**:检查 TensorFlow 官方文档以确认兼容性,并选择正确的 PythonTensorFlow 版本组合。例如,TensorFlow 2.x 通常支持 Python 3.7 至 3.9。 #### 3. GPU 支持配置问题 当尝试启用 GPU 支持时,可能会遇到 CUDA 或 cuDNN 配置错误的问题。例如,CUDA 版本与 TensorFlow 不兼容或驱动程序未正确安装[^2]。 - **解决方法**:确保安装了与 TensorFlow 兼容的 CUDA 和 cuDNN 版本。例如,对于 TensorFlow 2.10,推荐使用 CUDA 11.2 和 cuDNN 8.1。 #### 4. 模型转换问题 在将 TensorFlow 模型转换为 TensorFlow Lite 格式时,可能会遇到不支持的操作或依赖问题[^3]。 - **解决方法**:检查模型中是否包含 TensorFlow Lite 不支持的操作,并根据官方指南进行调整或自定义实现[^3]。可以参考以下链接了解支持的操作列表:https://www.tensorflow.org/lite/guide/ops_select #### 5. 版本更新导致的依赖冲突 TensorFlow 的频繁更新可能导致某些依赖项无法找到最新版本,例如 `org.tensorflow:tensorflow-lite-support` 报错找不到指定版本[^3]。 - **解决方法**:访问 Maven 中央仓库以查找最新的依赖项版本,并更新项目的构建文件(如 `build.gradle`)。例如,可以访问以下链接查找最新版本:https://search.maven.org/artifact/org.tensorflow/tensorflow-lite-support #### 6. 环境隔离问题 在多项目环境中,可能会出现 TensorFlow 与其他库版本冲突的情况。例如,某些全局安装的库可能干扰 TensorFlow 的正常运行。 - **解决方法**:使用虚拟环境(如 `venv` 或 `conda`)隔离项目依赖。创建虚拟环境的命令如下: ```bash python3 -m venv tf_env source tf_env/bin/activate pip install tensorflow ``` --- ### 示例代码:检查 TensorFlow 安装是否成功 以下代码可用于验证 TensorFlow 是否正确安装并能正常运行: ```python import tensorflow as tf # 检查 TensorFlow 版本 print("TensorFlow version:", tf.__version__) # 测试 GPU 是否可用 print("Is GPU available?", tf.test.is_gpu_available()) ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值