Bouncy Castle offline version or AES 256 key

9 replies 246 views
satoshi_degenFull Member
Posts: 40 · Reputation: 375
#1Jun 30, 2025, 02:49 AM
Is there anyone here who has a compiled version of Bouncy Castle for offline use? Also, I'm trying to figure out how to decrypt a 34-character string using a 16-character AES secret key. Any ideas?
7 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#2Jun 30, 2025, 06:06 AM
I can't give good answer, but i assume you're trying to recover Bitcoin from encrypted file/key. So i would recommend you to tell us what wallet software used to generate it, since there may be dedicated software to perform recovery/brute-force (such as BTCRecover that support many wallet format/software). 34 characters? It may be mini private key, although usually it have either 22 or 30 characters instead. Although Bitcoin legacy/P2PKH address usually have 34 characters.
1 Reply Quote Share
satoshi_degenFull Member
Posts: 40 · Reputation: 375
#3Jun 30, 2025, 06:56 AM
it was used in the beginning with BitcoinJ I believe I can use the secret key on that 34 characters to get the wif or the private key BittcoinJ used the AES encryption and it was safer then bitcoin 0.3.24 Bitcoin 0.4 started with the passphrases but this was before that
7 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#4Jul 2, 2025, 02:53 AM
Why aren't you using BitcoinJ library again? The newer versions should have kept some backward compatibility which means if we assume your encrypted key is not broken, you should be able to enter it into its decryption function (you gotta find that yourself though) with your password and get the key.
2 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#5Jul 2, 2025, 07:02 AM
I agree with @pooya87. Using BitcoinJ should be easier than using Bouncy Castle directly. I don't know how to run/use BitcoinJ, but you can download older version of BitcoinJ library on https://repo1.maven.org/maven2/org/bitcoinj/bitcoinj-core/. I forget to ask about it earlier, but do you mind share the 34 characters format? Does it match any of format shown on https://en.bitcoin.it/wiki/List_of_address_prefixes? If no, how about the basic format (such as binary, hex or base64)?
0 Reply Quote Share
satoshi_degenFull Member
Posts: 40 · Reputation: 375
#6Jul 2, 2025, 10:28 PM
the string starts with a 3, yes that would be P2SH but that I tried everything and tested everything, The first P2SH was mined april 1 2012, looking at old pictures from where I lived and so on, I know it was before that time. And found the jre from then and the documentation all from 2011 The string is Base58 and when I base64 -> Hex the string of 16 characters it starts with ECA1111111111CD999999999 the numers 1 are 10 capital letters and the numbers 9 are 9 capital letters But I will try to compile BitcoinJ Just tought that in BC I could test them by entering them in different aes formats like 128 and 256 or whatever
3 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#7Jul 3, 2025, 04:26 AM
It usually is not that simple (to use your password directly as the encryption key). Sometimes an encryption key is derived from your password and then used for encryption which means you have to use the same algorithm to derive that key to be able to decrypt. Which is why I suggested you use BicoinJ itself. Although I am assuming what you have is an encrypted key because 34-char long Base58 string doesn't look like an encrypted 256-bit private key. In comparison a BIP-38 encrypted key is 58 characters long in Base-58 (39 raw bytes when decoded).
3 Reply Quote Share
satoshi_degenFull Member
Posts: 40 · Reputation: 375
#8Jul 3, 2025, 06:19 AM
if the 34 character is encoded with delfi heilman it would still be 34 characters but completely different back in 2011 bitcoin until 0.4 didnt have a wallet private key encryption there was ASN.1 aes UTF-8 but no complex things bitcoinj used aes but what was also used? bitcoinj wallet wasnt compatible with bitcoin core wallet but what else?
4 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#9Jul 3, 2025, 10:58 AM
AFAIK the "Diffie-Hellman" algorithm is a protocol that two parties use to share a secret not an individual to encrypt their own secret. 34 characters is still too low because we are talking about a 256-bit (32-byte) key and when encoded to human readable form, any encoding (Base-64, 58, 43, 16) will at least produce roughly 44 characters. For example this is a random 32-byte hash with different encodings: And again you have to check the tool you used (BitcoinJ?) and see what encoding they were using. The 4 above are common (B43 less common), but there can be an encoding with more charset that shrinks the size.
4 Reply Quote Share
satoshi_degenFull Member
Posts: 40 · Reputation: 375
#10Jul 3, 2025, 03:30 PM
i've been digging a bit further and found a hex starting with 0x8 according to https://en.bitcoin.it/wiki/List_of_address_prefixes that would be the private key but including the 0x8 its 42 characters? those 16 characters could be the salt in openssl or without 0x hash160 the 40 characters?
5 Reply Quote Share

Related topics