我在Google上找不到任何加密/混淆我的lua文件的工具,所以我决定在这里问一下.也许有些专业人士知道怎么做?(免费).
我现在在lua做了一个简单的游戏,我不希望别人看到代码,否则他们很容易作弊.如何将.lua文件中的整个文本设为随机字母和内容?
我以前用C#编程,我有一个名为SmartAssembly的.NET混淆器,效果很好.当有人试着检查我的应用程序的代码时,它只是一堆字母和数字以及中文字符和东西.
任何人都知道任何程序可以为lua做到这一点吗?只需加载要加密的文件,单击加密或soemthing,然后bam!有用!?
例如:
print('Hello world!')
Run Code Online (Sandbox Code Playgroud)
会变成类似的东西
sdf9sd@@@&/sdfsdd9fd0f0fsf/&
Run Code Online (Sandbox Code Playgroud) 我已经将Laravel从4.0升级到4.1.我的应用程序设置了Cookie,我也在javascript中使用它.现在它们会自动加密,因此在javascript中不再可读.我找不到如何禁用特定cookie的加密当我尝试使用PHP setcookie本机功能设置它们时,它们不会持久存在.
这有解决方案吗?
我有一个带有DES/ECB/PKCS5Padding的私钥文件(由一个秘密短语生成的56位DES密钥),我想解密它.我不知道为什么,但每次我尝试decript,我的密码类的方法doFinal抛出这个错误:
javax.crypto.BadPaddingException:给出com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)的com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)的最终块没有正确填充.sun.crypto.provider.DESCipher.engineDoFinal(DashoA13*..)在javax.crypto.Cipher.doFinal(DashoA13*..)at ...
这是我的代码:
public static PrivateKey readPrivateKeyFromFile(File file, String chaveSecreta) {
try {
SecureRandom r = new SecureRandom(chaveSecreta.getBytes());
KeyGenerator keyGen = KeyGenerator.getInstance("DES");
keyGen.init(56, r);
Key key = keyGen.generateKey();
byte[] privateKeyBytes = decryptPKFile(file, key);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
PrivateKey privateKey = null;
try {
privateKey = keyFactory.generatePrivate(privateKeySpec);
} catch (InvalidKeySpecException e) {
JOptionPane.showMessageDialog(null, "Erro 01, tente mais tarde");
}
return privateKey;
} catch (NoSuchAlgorithmException e) {
JOptionPane.showMessageDialog(null, "Erro 02, tente mais tarde");
}
return null; …Run Code Online (Sandbox Code Playgroud) 我有一个项目,我们每隔5分钟就会向文件中写入少量数据.我们的想法是查看这些数据在数小时,数天和数周内的变化情况.
其中一个要求是以安全格式存储此数据.我们已经有了一种加密方案,可以通过DataI/O流将这些数据作为byte []数组通过网络发送.
我的问题是,有没有办法将加密的byte []数组写入文本文件,以便我可以将它们读出来?我目前最大的问题是我正在从文件中读取字符串,这会弄乱byte []数组.
关于去哪里的任何想法或指示?
我试图使用java bouncy castle库来使用RSA来解密和解密一个短字节数组.我做了以下步骤:
我注意到原始和解密的数据数组不一样.解密的数据数组缺少第一个条目,因此比原始数据数组短1.仅当数据数组的第一个条目为"0"时才会发生这种情况.为什么会这样?解密不应该返回相同的数据数组吗?或者我对图书馆的假设,使用和理解是错误的?
这里是完整的测试用例(带有导入以便更好地理解):
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.math.BigInteger;
import java.security.*;
import java.security.spec.RSAKeyGenParameterSpec;
import java.util.Arrays;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import org.bouncycastle.crypto.DataLengthException;
import org.bouncycastle.crypto.InvalidCipherTextException;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jce.provider.JDKKeyPairGenerator;
import org.bouncycastle.util.encoders.Hex;
import org.hive2hive.core.H2HJUnitTest;
import org.junit.Test;
public class EncryptionUtil2Test {
@Test
public void testBug() throws IOException, InvalidKeyException, IllegalBlockSizeException,
BadPaddingException, DataLengthException, IllegalStateException, InvalidCipherTextException,
NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException,
InvalidAlgorithmParameterException {
Security.addProvider(new BouncyCastleProvider());
// generate RSA keys
BigInteger publicExp = new BigInteger("10001", 16); // Fermat …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种在客户端解密S/MIME电子邮件的方法.我特别不希望客户端与服务器共享私钥,因此需要找到一种方法让客户端自己完成所有操作.
我不需要支持多个浏览器,因此使用目前仅适用于Mozilla Firefox的window.Crypto之类的东西是完全没问题的.这尤其是因为客户端上的浏览器将以某种方式需要访问客户端计算机上的证书存储(为了访问私钥 - 当然需要用户的批准).
我只是迷失在哪里开始,因为几乎不可能找到任何关于做这样的事情的示例或教程,所以你可以分享的任何代码都将受到欢迎.
我已经搜索了Stack Overflow和互联网,但是我无法找到为什么ssl_accept()不断返回的答案:
[DEBUG] SSL_accept() : Failed with return 0
[DEBUG] SSL_get_error() returned : 5
[DEBUG] Error string : error:00000005:lib(0):func(0):DH lib
[DEBUG] WSAGetLastError() returned : 0
[DEBUG] GetLastError() returned : 0
[DEBUG] ERR_get_error() returned : 0
Run Code Online (Sandbox Code Playgroud)
编辑:出于兴趣,ssl_accept()返回0,定义为(相应于缺乏和无用的OpenSSL文档):"TLS/SSL握手未成功但被关闭控制并受到TLS/SSL协议规范的控制. SSL_get_error()返回值为ret,找出原因."
下面是服务器端的片段,我可能会咆哮错误的树,这个问题是由客户端代码引起的吗?
client = accept( server, (sockaddr*) &clientsockaddrin, &len );
SSL* ssl = SSL_new( ctx );
SSL_set_fd( ssl, client );
std::cout << "+--------------------------------------------------+"
<< std::endl;
int r = SSL_accept( ssl );
if ( r != 1 )
{
int err_SSL_get_error = SSL_get_error( ssl, r); …Run Code Online (Sandbox Code Playgroud) 我们的asp.net应用程序运行良好,然后DBA决定对web.config中的db密码进行加密。现在我得到这个错误:
System.Security.Cryptography.CryptographicException: Not enough storage is available to process this command.
Run Code Online (Sandbox Code Playgroud)
在SO上只有另一篇文章列出了此错误,并且用户诉诸于重构而不是确定解决方案。
奇怪的是,我们有足够的空间(RAM,HDD等)。更奇怪的是,我们团队中的三个人都没有这个问题(网址完全相同)。另一个人昨天有它,但今天可以工作。
我担心何时将其移至产品中。特别是,如果这需要为每个用户提供某种增量存储或权限。
编辑:似乎出现的另一个错误是:
"Failed to decrypt using provider 'RsaProtectedConfigurationProvider'"
Run Code Online (Sandbox Code Playgroud) 我需要以这样的URL传递加密格式的数据,
http://localhost:8080/app/{encrypted_data}
那么,是否有编码器中不包含正斜杠(/)的编码器?
请注意:我不想手动从编码数据中用另一个字符替换'/'.
.................................................. .................................................. ..........
编辑:Oleg Estekhin评论使用Base64 URL安全编码工作正常,我只是在这里添加一个例子.
示例:编码:
String str = "subjects?_d=1";
byte[] bytesEncoded = Base64.encodeBase64URLSafe((str.getBytes()));
Run Code Online (Sandbox Code Playgroud)
解码:
Base64 decoder = new Base64(true);
byte[] decodedBytes = decoder.decode(new String(bytesEncoded));
System.out.println(new String(decodedBytes));
Run Code Online (Sandbox Code Playgroud)
输出:
c3ViamVjdHM_X2Q9MQ
subjects?_d=1
Run Code Online (Sandbox Code Playgroud) 我对BouncyCastle和pgp很新.我在互联网上看过很多文章和样本.几乎每个加密样本都包含下面剪切的代码
if (armor)
out = new ArmoredOutputStream(out);
Run Code Online (Sandbox Code Playgroud)
似乎我的本地测试通过了护甲和无护甲.我用google搜索但发现很少有用,而ArmoredOutputStream的javadoc只显示这是基本的输出流.
那么有什么区别以及何时使用它?
完整的代码示例:
public static void encryptFile(String decryptedFilePath,
String encryptedFilePath,
String encKeyPath,
boolean armor,
boolean withIntegrityCheck)
throws Exception{
OutputStream out = new FileOutputStream(encryptedFilePath);
FileInputStream pubKey = new FileInputStream(encKeyPath);
PGPPublicKey encKey = readPublicKeyFromCollection2(pubKey);
Security.addProvider(new BouncyCastleProvider());
if (armor)
out = new ArmoredOutputStream(out);
// Init encrypted data generator
PGPEncryptedDataGenerator encryptedDataGenerator =
new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, withIntegrityCheck, new SecureRandom(),"BC");
encryptedDataGenerator.addMethod(encKey);
OutputStream encryptedOut = encryptedDataGenerator.open(out, new byte[BUFFER_SIZE]);
// Init compression
PGPCompressedDataGenerator compressedDataGenerator = new PGPCompressedDataGenerator(PGPCompressedData.ZIP);
OutputStream compressedOut = compressedDataGenerator.open(encryptedOut);
PGPLiteralDataGenerator …Run Code Online (Sandbox Code Playgroud) encryption ×10
java ×5
bouncycastle ×2
rsa ×2
.net ×1
arrays ×1
asp.net ×1
c++ ×1
cookies ×1
encoding ×1
file ×1
javascript ×1
laravel-4 ×1
lua ×1
obfuscation ×1
openpgp ×1
openssl ×1
pgp ×1
smime ×1
web-config ×1