1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [pycrypto] RSA exportKey question with bcrypt?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20RSA%20exportKey%20question%20with%20bcrypt%3F&In-Reply-To=%3CCAGfyce2zHWAxp3Ajzm-OaXYC0YQKjTL0V6mvmN8YbfhUNhbXBw%40mail.gmail.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000686.html">
<LINK REL="Next" HREF="000688.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[pycrypto] RSA exportKey question with bcrypt?</H1>
<B>Legrandin</B>
<A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20RSA%20exportKey%20question%20with%20bcrypt%3F&In-Reply-To=%3CCAGfyce2zHWAxp3Ajzm-OaXYC0YQKjTL0V6mvmN8YbfhUNhbXBw%40mail.gmail.com%3E"
TITLE="[pycrypto] RSA exportKey question with bcrypt?">helderijs at gmail.com
</A><BR>
<I>Tue Jul 16 13:08:01 PDT 2013</I>
<P><UL>
<LI>Previous message: <A HREF="000686.html">[pycrypto] RSA exportKey question with bcrypt?
</A></li>
<LI>Next message: <A HREF="000688.html">[pycrypto] RSA exportKey() changes set in stone for 2.7?
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#687">[ date ]</a>
<a href="thread.html#687">[ thread ]</a>
<a href="subject.html#687">[ subject ]</a>
<a href="author.html#687">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hi Manuel,
Yes, that is my understanding as well.
The current code uses the PEM headers you indicate for the various
cases (see below for actual output).
I also find this link quite useful:
<A HREF="https://polarssl.org/kb/cryptography/asn1-key-structures-in-der-and-pem">https://polarssl.org/kb/cryptography/asn1-key-structures-in-der-and-pem</A>
>>><i> from Crypto.PublicKey import RSA
</I>>>><i> k = RSA.generate(1024)
</I>>>><i> print k.exportKey('PEM', pkcs=1)
</I>-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQC+2fP2il/1+Yvr1ctB67+sFPq5hs0bOZ9R4l/Pt9cRKxFAKGDY
[...]
>>><i> print k.exportKey('PEM', passphrase='rr', pkcs=1)
</I>-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,FEE6839853DD42B2
MWIPA268NMYw4kFCc5wVn/Dscb8adCpJnFZOF/8CZay+3ik6wIu8yAvlDrUiKguI
[...]
>>><i> print k.exportKey('PEM', passphrase='rr', pkcs=8)
</I>-----BEGIN PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,E95D4DA9934F6C0E
HZxEFCZq5Qixt08u2Td8etx5poaN7NxwrrP4zlfcNuYb0gyA/4QYc/1FOEFqjWbQ
[...]
>>><i> print k.exportKey('PEM', passphrase='rr', pkcs=8, protection='PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC')
</I>-----BEGIN ENCRYPTED PRIVATE KEY-----
MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIt4O8Lxapq8MCAgPo
[...]
2013/7/16 Manuel Pégourié-Gonnard <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">mpg at elzevir.fr</A>>:
><i> On 16/07/2013 08:48, Manuel Pégourié-Gonnard wrote:
</I>>><i> -----BEGIN RSA RIVATE KEY----- PKCS#1 in a PEM envelope
</I>>><i> -----BEGIN RIVATE KEY----- unencrypted PKCS#8 in a PEM envelope
</I>>><i> -----BEGIN RSA RIVATE KEY----- encryptedd PKCS#8 in a PEM envelope
</I>>><i>
</I>><i> Oops, I meant:
</I>><i>
</I>><i> -----BEGIN RSA RIVATE KEY----- PKCS#1 in a PEM envelope
</I>><i> -----BEGIN PRIVATE KEY----- unencrypted PKCS#8 in a PEM envelope
</I>><i> -----BEGIN ENCRYPTED PRIVATE KEY----- encrypted PKCS#8 in a PEM envelope
</I>><i>
</I>><i> Manuel.
</I>><i> _______________________________________________
</I>><i> pycrypto mailing list
</I>><i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">pycrypto at lists.dlitz.net</A>
</I>><i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</A>
</I></PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000686.html">[pycrypto] RSA exportKey question with bcrypt?
</A></li>
<LI>Next message: <A HREF="000688.html">[pycrypto] RSA exportKey() changes set in stone for 2.7?
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#687">[ date ]</a>
<a href="thread.html#687">[ thread ]</a>
<a href="subject.html#687">[ subject ]</a>
<a href="author.html#687">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
mailing list</a><br>
</body></html>
|