📄 encryptini.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: EncryptINI.java
package jit.util.jitca.ini;
import java.io.ByteArrayInputStream;
import jit.asn1parser.Parser;
import jit.crypto.CipherParameters;
import jit.jcrypto.*;
import jit.jcrypto.soft.JMechanism;
import jit.util.encoders.Base64;
// Referenced classes of package jit.util.jitca.ini:
// ProFile
public class EncryptINI
{
static final Mechanism mechanism = new JMechanism(289);
public EncryptINI()
{
}
public static byte[] getValue(Session session, ProFile proFile, String section, String key, JKey decryptKey)
throws Exception
{
String value = proFile.getValue(section, key);
if(key.charAt(0) != '!' || decryptKey == null)
{
return Base64.decode(value);
} else
{
byte en_data[] = Base64.decode(value);
byte de_data[] = session.decrypt(mechanism, decryptKey, en_data);
return de_data;
}
}
public static void setValue(Session session, ProFile proFile, String section, String key, byte value[], JKey encryptKey)
throws Exception
{
String svalue = null;
if(key.charAt(0) != '!' || encryptKey == null)
{
svalue = new String(Base64.encode(value));
} else
{
CipherParameters param = Parser.conver2CipherParam(encryptKey);
byte en_data[] = session.encrypt(mechanism, encryptKey, value);
svalue = new String(Base64.encode(en_data));
}
proFile.storeValue(section, key, format(key, svalue, 80));
}
public static String format(String head, String source, int length)
throws Exception
{
if(head.length() + source.length() + 1 < length)
return source;
ByteArrayInputStream bis = new ByteArrayInputStream(source.getBytes());
StringBuffer buffer = new StringBuffer();
byte line1[] = new byte[length - head.length() - 1];
bis.read(line1);
buffer.append(new String(line1));
int readLen = -1;
do
{
byte tmpLine[] = new byte[length - 2];
readLen = bis.read(tmpLine);
buffer.append("\n->");
buffer.append((new String(tmpLine)).trim());
} while(readLen >= length - 2);
return buffer.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -