Latest Questions tagged Cryptography

Browse all latest questions tagged Cryptography

50
Votes
Published 02 Oct, 2022
Java - Base64 encode/decode in ECC encrypt and decrypt

I want to test the ECC algorithm encrypt and decrypt. I write code to: Generate key pair (publickey and privatekey) ---> write them to file (maybe not secure but I just only test). Then using publi...

84
Votes
Published 07 Sep, 2022
Java - Why do people use bouncycastle instead of Java's built in JCE provider? What is the difference?

Why do people use bouncycastle instead of Java Cryptography Extension? What is the difference?

47
Votes
Published 13 Aug, 2022
Python - Python Cryptography export key to DER

In the past when using PyCrypto I was able to do the following to generate a fingerprint of a RSA public key: rsa_cipher = PKCS1_v1_5.new(RSA.importKey(pub_rsa_key)) hashlib.sha1(rsa_cipher._key.expo...

104
Votes
Published 14 Aug, 2022
Python - basics of python encryption w/ hashlib sha1

I'm struggling to fully understand how encryption works and is coded, particularly with python. I'm just trying to get the basics down and create code in the simplest form. I'm going to be passing a...

49
Votes
Published 15 Sep, 2022
Java - error decrjavax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption

I am facing the following issue while working with Java cryptography. error decrjavax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used dur...

102
Votes
Published 10 Jun, 2022
Python - Python RSA Brute Force Check

I have an exercise to brute force a piece of text that has been encrypted with a very small key. The public key I have is (e = 5, n = 203). The text has been converted to ASCII, shifted a fixed number...

6
Votes
Published 01 May, 2022
Python - Decrypt MD5 hash

Is there any way to decrypt the encrypted MD5 string, given the key?

9
Votes
Published 21 Aug, 2022
Java - Decrypt the encrypted file content?

I am having a problem decrypting a file using RSA public key decryption. My process is to receive the xml file, encrypt the content, and write it back to the same file. Another function decrypts the c...

4
Votes
Published 03 May, 2022
Python - How to implement Fernet encryption with AES 256

I'm currently using Fernet encryption which uses AES 128 keys. However my client requires using AES 256. I'm not very familiar with cryptography but here is what I understood so far. Fernet needs a 2...

99
Votes
Published 16 Aug, 2022
Python - Decrypt Python cryptography fernet token in C#

I have written an encryption function in Python, which works fine. from cryptography.fernet import Fernet def Encryptor(password): key = b'MAKV2SPBNI99212' cipher_suite = Fernet(key) ciph...

96
Votes
Published 14 Aug, 2022
Python - How to sign a document in python with M2Crypto using particular padding technique?

I need to digitally sign some text in python using a private key stored in a .pem file. It seems like M2Crypto is the preferred way to do that these days, so that's what I'm using. I think I get mos...

25
Votes
Published 12 Aug, 2022
Python - RSA Encryption Padding issues between Python and Java

I am trying to RSA encrypt some data in python using a public key that was generated by a client in android. The encryption goes successfully (atleast there are no exceptions). However, when trying to...

77
Votes
Published 11 Aug, 2022
Python - Optimising multiplication modulo a small prime

I need to do the following operation many times: Take two integers a, b Compute a * b mod p, where p = 1000000007 and a, b are of the same order of magnitude as p My gut feeling is the naive resu...

28
Votes
Published 09 Aug, 2022
Python - TLS in Twisted Python - How to create server.pem?

I've just discovered Twisted in Python, and have been looking at the echoserv_ssl.py sample as found here: https://twistedmatrix.com/documents/14.0.0/core/howto/ssl.html. Just above the sample code, t...

56
Votes
Published 16 Apr, 2022
Javascript - Secure random numbers in javascript?

How do I generate cryptographically secure random numbers in javascript?