代码拉取完成,页面将自动刷新
import javax.crypto.Cipher
import java.security.KeyFactory
import java.security.spec.PKCS8EncodedKeySpec
import java.security.spec.X509EncodedKeySpec;
ext.rsaEncrypt = { String input ->
def key = Base64.decoder.decode(file("tools/key.pri").readBytes())
def privateKey = KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(key))
def cipher = Cipher.getInstance("RSA")
cipher.init(Cipher.ENCRYPT_MODE, privateKey)
return cipher.doFinal(input.getBytes()).encodeHex().toString()
}
ext.rsaDecrypt = { String input ->
def key = Base64.decoder.decode(file("tools/key.pub").readBytes())
def publicKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(key))
def cipher = Cipher.getInstance("RSA")
cipher.init(Cipher.DECRYPT_MODE, publicKey)
return new String(cipher.doFinal(input.decodeHex()))
}
ext.initFlavorConfig = { flavor ->
println("====> ${flavor.name}")
if (extensions.extraProperties.has("configFields") && configFields[flavor.name]) {
// println("configFields -> ${configFields[flavor.name]}")
for (def item : configFields[flavor.name]) {
flavor.buildConfigField "String", item.key, '"' + item.value + '"'
}
}
if (extensions.extraProperties.has("stringValues") && stringValues[flavor.name]) {
// println("stringValues -> ${stringValues[flavor.name]}")
for (def item : stringValues[flavor.name]) {
flavor.resValue "string", item.key, item.value
}
}
if (extensions.extraProperties.has("placeholders") && placeholders[flavor.name]) {
// println("placeholders -> ${placeholders[flavor.name]}")
flavor.addManifestPlaceholders(placeholders[flavor.name])
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。