বৃহস্পতিবার, ২৪ অক্টোবর, ২০২৪

DeploymentRuleSet creation for java security

 Java Signing directory
cd D:\middleware\oracle_common\jdk\bin

Making ruleset.xml

<ruleset version="1.0+">
<rule>
    <id location="http://localhost:9001" />
    <action permission="run" version="1.8*" />
</rule>
</ruleset>
Making jar file
jar.exe -cvf DeploymentRuleSet.jar ruleset.xml

Making jks file
keytool.exe -genkey -alias Selfsigned -keystore "Selfsigned.jks" -keyalg RSA -keysize 2048 -startdate "2000/01/01 00:00:00" -validity 18262

Making cer file
keytool.exe -export -file "Selfsigned.cer" -alias Selfsigned -keystore "Selfsigned.jks"
c:\windows\system32\certutil.exe -addstore "Root" .\Selfsigned.cer

Jar signer
jarsigner.exe -keystore "Selfsigned.jks" -signedjar "DeploymentRuleSet.jar" DeploymentRuleSet.jar selfsigned

Testing
jarsigner -verify -verbose -certs DeploymentRuleSet.jar
jarsigner -verify -keystore Selfsigned.jks DeploymentRuleSet.jar