예제 #1
0
void igs_m036_state::init_igsm312()
{
	init_igs_m036();

	igs036_decryptor decrypter(m312cn_key);
	decrypter.decrypter_rom((uint16_t*)memregion("user1")->base(), memregion("user1")->bytes(), 0);
}
예제 #2
0
파일: RSATest.cpp 프로젝트: rayfill/cpplib
	void endecryptFor1024bitKeyTest()
	{
		MPInteger encryptExponent("00010001");
		MPInteger modulus(
			"7ef57a896736682c97adea5669df5ce8764c05e3f00f5e5b882d1"
			"1955e68ba46d61e65f97fac21df965e933157f269139a7a38078c"
			"3c2e595a7ee17fa23cb562c00b9336dbea41555dc8a577d193106"
			"4d4eff76e93dc5bdd4c531ac0603125d61cd7d91017adb97fc777"
			"741f7680206e65a648875a3e93ff12ad26781d0e56d1");

		MPInteger decryptExponent(
			"0cae5448f928340b9032ecdf28c008b5a76b3c8361ed070db9725"
			"6f9466ecb7c5bd2b978cc49d3305402aa4d196dbb151c2eecfdc4"
			"0216d711f4ee6d23355120a1e59074a2408f457b216b8d90dd809"
			"1947684d57ebff65c55bc2af13d7d84396de565c40513f02dce13"
			"5e075a26835acc0f367dd2e58c5e2f9e370584e02481");

		MPInteger plaintext = "abffe123f875b1f45da2b2ca";

		PublicKey pubkey(encryptExponent, modulus);
		PrivateKey privkey(decryptExponent, modulus);

		RSA cipher(pubkey);
		MPInteger ciphertext = cipher.encrypt(plaintext);

		CPPUNIT_ASSERT(plaintext != ciphertext);

		RSA decrypter(privkey);
		MPInteger decrypttext = decrypter.decrypt(ciphertext);
		
		CPPUNIT_ASSERT(plaintext == decrypttext);

	}
예제 #3
0
DRIVER_INIT_MEMBER(igs_m036_state, igsm312)
{
	DRIVER_INIT_CALL(igs_m036);

	igs036_decryptor decrypter(m312cn_key);
	decrypter.decrypter_rom(memregion("user1"));
}
예제 #4
0
DRIVER_INIT_MEMBER(igs_m036_state, cjddzsp)
{
	DRIVER_INIT_CALL(igs_m036);

	igs036_decryptor decrypter(cjddzsp_key);
	decrypter.decrypter_rom(memregion("user1"));
}
예제 #5
0
	schar * DecryptBinaryFile(const tstring & file, uint32 & size,
		const std::function<schar*(const schar*, uint32&)> & decrypter, 
		DirectoryMode directory)
	{
		schar * buffer = ReadBinaryFile(file, size, directory);
		schar * decryptedBuffer = decrypter(buffer, size);
		delete [] buffer;
		return decryptedBuffer;
	}
예제 #6
0
QCA::SecureArray EncryptedStore::decryptFile(QCA::SecureArray & encryptedFile, KoEncryptedStore_EncryptionData & encData, QCA::SecureArray & password)
{
    QCA::SecureArray keyhash = QCA::Hash("sha1").hash(password);
    QCA::SymmetricKey key = QCA::PBKDF2("sha1").makeKey(keyhash, QCA::InitializationVector(encData.salt), 16, encData.iterationCount);
    QCA::Cipher decrypter("blowfish", QCA::Cipher::CFB, QCA::Cipher::DefaultPadding, QCA::Decode, key, QCA::InitializationVector(encData.initVector));
    QCA::SecureArray result = decrypter.update(encryptedFile);
    result += decrypter.final();
    return result;
}