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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [pycrypto] Public Key encryption of files
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Public%20Key%20encryption%20of%20files&In-Reply-To=CAEncD4e91oCifceev3ZxbSpoYT3P3V6zrzcMgf11ht69TBcmgQ%40mail.gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000503.html">
<LINK REL="Next" HREF="000505.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[pycrypto] Public Key encryption of files</H1>
<B>John Matthew</B>
<A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Public%20Key%20encryption%20of%20files&In-Reply-To=CAEncD4e91oCifceev3ZxbSpoYT3P3V6zrzcMgf11ht69TBcmgQ%40mail.gmail.com"
TITLE="[pycrypto] Public Key encryption of files">john at compunique.com
</A><BR>
<I>Thu Nov 10 12:32:01 CST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="000503.html">[pycrypto] Public Key encryption of files
</A></li>
<LI>Next message: <A HREF="000505.html">[pycrypto] Public Key encryption of files
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#504">[ date ]</a>
<a href="thread.html#504">[ thread ]</a>
<a href="subject.html#504">[ subject ]</a>
<a href="author.html#504">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>All good stuff, thanks Dave
On Thu, Nov 10, 2011 at 10:26 AM, Dave Pawson <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dave.pawson at gmail.com</A>> wrote:
><i> On 10 November 2011 18:18, Dean Macinskas <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dmacinskas at geobridge.net</A>>
</I>><i> wrote:
</I>><i> > All blocks need to be 16 bytes. So for example, if the file is 2,000,005
</I>><i> > bytes, you'd encrypt 125,000 16-byte blocks; you then have 5 bytes left
</I>><i> > over, to which you'd add 11 padding bytes, which can be any binary value
</I>><i> and
</I>><i> > then encrypt that last block.
</I>><i>
</I>><i>
</I>><i> def _lazysecret(secret, blocksize=32, padding='}'):
</I>><i> """pads secret if not legal AES block size (16, 24, 32)"""
</I>><i> if not len(secret) in (16, 24, 32):
</I>><i> return secret + (blocksize - len(secret)) * padding
</I>><i> return secret
</I>><i>
</I>><i> Python makes it quite easy.
</I>><i> The reason I started to use it!
</I>><i> Thanks to
</I>><i> src <A HREF="http://www.turnkeylinux.org/blog/python-symmetric-encryption">http://www.turnkeylinux.org/blog/python-symmetric-encryption</A>
</I>><i>
</I>><i> great piece of software.
</I>><i>
</I>><i> regards
</I>><i>
</I>><i>
</I>><i>
</I>><i> --
</I>><i> Dave Pawson
</I>><i> XSLT XSL-FO FAQ.
</I>><i> Docbook FAQ.
</I>><i> <A HREF="http://www.dpawson.co.uk">http://www.dpawson.co.uk</A>
</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>><i>
</I>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.dlitz.net/pipermail/pycrypto/attachments/20111110/56d31537/attachment.htm">http://lists.dlitz.net/pipermail/pycrypto/attachments/20111110/56d31537/attachment.htm</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000503.html">[pycrypto] Public Key encryption of files
</A></li>
<LI>Next message: <A HREF="000505.html">[pycrypto] Public Key encryption of files
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#504">[ date ]</a>
<a href="thread.html#504">[ thread ]</a>
<a href="subject.html#504">[ subject ]</a>
<a href="author.html#504">[ 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>
|