Bitcoin Forum
December 15, 2024, 03:31:32 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Private key (DER) convert to ...?  (Read 2214 times)
SgtSpike (OP)
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
February 19, 2013, 06:17:25 AM
 #1

How do I convert a Private Key (DER) (as shown at http://brainwallet.org/) to a private key that is importable into, say, blockchain.info?

Example private key:  308201130201010420c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39 a8aa081a53081a2020101302c06072a8648ce3d0101022100ffffffffffffffffffffffffffffff fffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a0629 5ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b4 48a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03 bbfd25e8cd0364141020101a1440342000478d430274f8c5ec1321338151e9f27f4c676a008bdf8 638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659c c3455
Parazyd
Hero Member
*****
Offline Offline

Activity: 812
Merit: 587


Space Lord


View Profile WWW
February 19, 2013, 08:06:26 AM
 #2

I don't know. Maybe you could try the converter: http://brainwallet.org/#converter

But you actually have a normal private key when you generate: http://brainwallet.org/#generator
Joric
Member
**
Offline Offline

Activity: 67
Merit: 130


View Profile
February 19, 2013, 02:35:38 PM
Merited by xandry (3)
 #3

Those (DER) keys are ASN-encoded, try http://lapo.it/asn1js/
It contains both private and public keys along with a generator OID description (in this case, 1.2.840.10045.1.1).
First OCTET STRING (32-bytes) is usually a secret exponent, which you may convert to Base58Check ver. 128 or import as is.

1JoricCBkW8C5m7QUZMwoRz9rBCM6ZSy96
Parazyd
Hero Member
*****
Offline Offline

Activity: 812
Merit: 587


Space Lord


View Profile WWW
February 19, 2013, 02:45:59 PM
 #4

lapo.it won't work.
Joric
Member
**
Offline Offline

Activity: 67
Merit: 130


View Profile
February 19, 2013, 05:33:57 PM
Merited by xandry (2)
 #5

just remove spaces from the copypaste above (forum engine breaks line every 160 chararacters)
Code:
308201130201010420c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8aa081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455

1JoricCBkW8C5m7QUZMwoRz9rBCM6ZSy96
SgtSpike (OP)
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
March 27, 2013, 04:35:48 AM
Last edit: March 27, 2013, 05:01:30 AM by SgtSpike
 #6

Those (DER) keys are ASN-encoded, try http://lapo.it/asn1js/
It contains both private and public keys along with a generator OID description (in this case, 1.2.840.10045.1.1).
First OCTET STRING (32-bytes) is usually a secret exponent, which you may convert to Base58Check ver. 128 or import as is.
Forgot to say thank you Joric!  Will send a small tip your way.  Wink

EDIT:  Also, question.  The OCTET STRING is "C4BBCB1FBEC99D65BF59D85C8CB62EE2DB963F0Fundefined".  This does not import to blockchain.info.  What's with the "undefined" bit at the end as well?

EDIT2:  0.2 BTC bounty to anyone who can provide a start-to-finish of converting the above DER key to something I can import into blockchain.info!
fpgaminer
Hero Member
*****
Offline Offline

Activity: 560
Merit: 517



View Profile WWW
March 27, 2013, 05:45:18 AM
 #7

Quote
EDIT:  Also, question.  The OCTET STRING is "C4BBCB1FBEC99D65BF59D85C8CB62EE2DB963F0Fundefined".  This does not import to blockchain.info.  What's with the "undefined" bit at the end as well?
lapo.it seems to have a bug when it displays the octet string.  Hover over it and look on the right where it has highlighted the hex dump.  Copy that part of the hex dump, except for the beginning "04 20".

If you want to do it manually, without lapo.it, just search your DER encoded private key from the beginning for "04 20" and grab the following 32 bytes (64 hex characters).  Example:

Code:
30820113020101
0420
c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a     <<<< Give this to blockchain.info
a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455

EDIT: I'm assuming you're getting the DER encoded key from somewhere other than brainwallet, as obviously if you already have it on brainwallet you can simply copy the Secret Exponent directly into blockchain.info.

SgtSpike (OP)
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
March 27, 2013, 07:10:10 AM
 #8

Quote
EDIT:  Also, question.  The OCTET STRING is "C4BBCB1FBEC99D65BF59D85C8CB62EE2DB963F0Fundefined".  This does not import to blockchain.info.  What's with the "undefined" bit at the end as well?
lapo.it seems to have a bug when it displays the octet string.  Hover over it and look on the right where it has highlighted the hex dump.  Copy that part of the hex dump, except for the beginning "04 20".

If you want to do it manually, without lapo.it, just search your DER encoded private key from the beginning for "04 20" and grab the following 32 bytes (64 hex characters).  Example:

Code:
30820113020101
0420
c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a     <<<< Give this to blockchain.info
a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455

EDIT: I'm assuming you're getting the DER encoded key from somewhere other than brainwallet, as obviously if you already have it on brainwallet you can simply copy the Secret Exponent directly into blockchain.info.
Oh, dang, that's easy.  I didn't know the bit I needed was right in the string from the start.  0.2 BTC coming your way!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!