Skip to content

New InterBase Partner DVD In Progress

The next version of InterBase is nearing completion, and, as always, will include a Partner DVD with demo versions of third-party tools supporting InterBase. If you are an InterBase Partner, you should have already been notified of how to submit your product.

If you produce a tool or component supporting InterBase and have not already received a notice about the Partner DVD, then please contact Anders Ohlsson (firstname.lastname@embarcadero.com) immediately.

Tagged ,

grid.history Demo Fixed

Apologies to those who tried my grid.history demo page Friday. In the course of updating the integration to support jqGrid 3.7.2 and simultaneously learning GitHub’s pages feature, I killed the demo. It’s fixed now, and I’ve added the ability to run the unit tests directly from that site, making it easier for me to test multiple browsers on the demo site, instead of just locally.

Tagged , , , ,

grid.history: A New, Free Integration for jqGrid and jQuery BBQ

I recently finished an integration between the open source jqGrid and jQuery BBQ libraries. I have released my integration as open source, as well. As with both projects, it is dual-licensed under the MIT and GPL licenses.

jqGrid is a JavaScript grid component with many useful features. I have previously explained how to use it with ASP.NET MVC.

jQuery BBQ is a library which helps you manage proper functionality of the web browser’s back and forward buttons by changing the fragment (hash) of the URI. Using my integration means that you can have a jqGrid on a web page and the back and forward buttons will work as expected.

To be specific, when you first load a certain page, the grid will probably be on page 1. You could click the next page button on the grid to go to page 2. Without my integration, clicking the back button would not take you back to page 1. With my integration, it will. Similarly, I support the sort and records per page combo box. You can of course extend this yourself to track other grid features.

The image above shows a demo page I’ve prepared, which you try for yourself. The grid on the left does not use the history plug-in. The grid on the right does. Note that when you page, sort, or change the number of rows shown in the grid with the history, the URI fragment also changes.

I have contributed my plug-in back to the jqGrid project. You can get the source from github.

Tagged , , , ,

Replacing Controller.Session in ASP.NET MVC: Is This Wrong?

Here’s some code I wrote:

public class MyBaseController : Controller
{
    // ...
    public new ISession Session { get; private set; }
    // ....
}

ISession is an interface type I wrote which exposes everything I store in the session at runtime. I use constructor injection to assign this to a simple type which maps to the "real" Session during application runtime, and a "mock" session for unit testing. Session, in ASP.NET, is a user-specific cache.

This hides Controller.Session (of type HttpSessionStateBase) and replaces it with a strongly-typed, mockable replacement. Normally I wouldn’t use public new, but in this specific case it seems like the best way. It stops developers from using the Web-dependent Session property in derived types and forces them to code to the strong-typed interface. But still, it’s public new, which seems yucky.

What do you think?

Tagged , ,

Book Review: Rework

Rework, by Jason Fried and David Heinemeier Hansson, cannot accurately be described as the "sequel" to the first book to come out of 37 Signals, Getting Real. As a significant percentage of the book seems to be word for word identical to text in Getting Real, I think it’s more of a "remix." Getting Real focused on creating marketable web software, whereas Rework changes the focus ever so slightly to growing a business around marketable web software.

If you’ve read Getting Real (you can sample it online for free at the link above, and in my opinion it’s worth the time to do so), or if you’ve seen one of DHH’s presentations, then you probably have a good idea of what to expect in Rework. It’s short, to the point, quotable, and uses 37 Signals as the model for everything that is good about how to run a business. I don’t fault the authors for being proud of their company, but if you are looking for a dispassionate examination of when it makes sense to run a business in the way that they do versus other ways, you won’t find it here. You quickly get the idea that the authors look at other methods of running a business about as fondly as DHH looks at WS-*. Again, this isn’t necessarily a bad thing. It’s clearly worked out pretty well for 37 Signals. One can’t fail to notice, however, that 37 Signals’s products fit within a pretty narrow spectrum. Will their techniques translate to other markets and other industries? Perhaps; perhaps not. Rework doesn’t really answer that question.

Did I say quotable? It’s full of snappy, almost pithy zingers which are so obviously right that they would seem like tautologies if they were not so commonly ignored:

  • Workaholics aren’t heroes. They don’t save the day, they just use it up. The real hero is already home because she figured out a faster way to get things done.
  • You’re better off with a kick-ass half than a half-assed whole.
  • It’s also unfortunate that meetings are typically scheduled like TV shows. You set aside thirty minutes or an hour because that’s how scheduling software works (you’ll never see anyone schedule a seven-minute meeting with Outlook).

I don’t think these are empty words. I’m convinced the authors run their company this way. I’m also convinced it works for them. They took their own advice writing the book, as well:

We cut this book in half between the next-to-last and final drafts. From 57,000 words to about 27,000 words. Trust us, it’s better for it. So start chopping. Getting to great starts by cutting out stuff that’s merely good.

But I don’t agree with everything in the book. Sometimes the cuteness of the writing overtakes the point. It’s generally true that you should focus on the essentials. But they illustrate this with:

For example, if you’re opening a hot dog stand, you could worry about the condiments, the cart, the name, the decoration. But the first thing you should worry about is the hot dog. The hot dogs are the epicenter. Everything else is secondary.

Guys, next time you’re in Columbus, look me up, and I’ll buy you lunch at Dirty Franks. I respect what you have to say about business, but we have a thing or two to settle about hot dogs.

Indeed, later in the book the authors make this very point quite elegantly, with a more apropos example:

When we start designing something, we sketch out ideas with a big, thick Sharpie marker, instead of a ballpoint pen. Why? Pen points are too fine. They’re too high-resolution. They encourage you to worry about things that you shouldn’t worry about yet, like perfecting the shading or whether to use a dotted or dashed line. You end up focusing on things that should still be out of focus.

Avoid false precision.

The point here, after all, is not how to run a hot dog business in particular; it’s how to run your business. The best way to fail if that is to let details and directions steer you away from the ideas that only you can bring to the table. This is why "look inside yourself" can be a better approach to planning and business strategy than following an off-the-shelf formula. For most people, creating a new, free, application framework is the worst possible way to start a business selling web applications. I’ve seen many, many people fail at this. Except that for 37 Signals, it worked really well, perhaps because of the specific people who ran the company.

I strongly agree with the authors when they say:

Pour yourself into your product and everything around your product too: how you sell it, how you support it, how you explain it, and how you deliver it. Competitors can never copy the you in your product.

This is why it’s OK that Rework can be self-contradictory at times. In one chapter, the authors suggest that you "pick a fight." A good example of this is how Stack Overflow was to some degree a response to "hyphen-site." Only a few chapters later, however, the authors say:

Focus on competitors too much and you wind up diluting your own vision. Your chances of coming up with something fresh go way down when you keep feeding your brain other people’s ideas. You become reactionary instead of visionary. You wind up offering your competitor’s products with a different coat of paint. If you’re planning to build “the iPod killer” or “the next Pokemon,” you’re already dead. You’re allowing the competition to set the parameters.

Self-contradictory? Absolutely. Again, Rework is not a formula for how people with no interest in widgets can start a widget business. It’s written to provoke the reader, hopefully provoking them into keeping their business focused on what they can uniquely bring to the table.

Naturally, this presumes that the reader is, to some degree, interesting, and has ideas for things which could benefit other people. It’s not clear to me if everyone has good ideas, but many people don’t execute them, or if some people don’t execute good ideas because they don’t have them. What is clear is that having good ideas and not executing them is little better than not having them.

Tagged , , , , ,

Stir Trek 2: Iron Man Edition Wrap Up

Last Friday, I attended the Stir Trek conference here in Columbus. The day got off to an inauspicious start when I turned on my car. There was a high screaming noise, and acrid black smoke poured out from the engine. I opened the hood, pulled out a burning air-conditioner drive belt, and threw it into the bushes beside me. Now the engine ran fine! (Although, for some reason, this did not reassure my wife.)

The conference is held in a local movie theater. After a day of technical sessions, the attendees would be treated to a screening of Iron Man 2. I wasn’t able to stay long enough for that, but the technical content was more than worth the time and the measly $25 cost of the conference. The theater was still a great place to have a technical conference. The screens were huge and the seats were comfortable.

Keynote

Molly Holzschlag was scheduled to be the keynote speaker, but could not fly due to an ear infection and doctors orders. So she gave her keynote address, and a presentation on HTML 5 later on, via Skype, which was probably better than nothing, but only marginally so, given Internet bandwidth not really sufficient for real-time video. It at least provided some amusement when poorly-timed drop outs turned innocuous technical material into profanities. The HTML 5 presentation suffered from a lack of slides, which Molly made up for by asking us to imagine HTML DOCTYPEs and the like. I appreciate Molly going the extra mile to not leave the conference in the cold, but I didn’t get a lot out of these sessions, which is too bad, because HTML 5 is an ongoing concern for me right now.

Seeing Constraints, Kanban Explained

Generally, I rank conference presentations by whether or not I come out of them with useful information or ideas that I can put into practice back at work. The Kanban session did succeed in that respect. The speaker’s style was very conversational, almost off-the-cuff. He is a process consultant and related a lot of anecdotes about situations he has worked in.

One thing he emphasized which I do not see in much of the writing about Kanban is to use multiple boards when appropriate. For example, a development team can have "their own" board for non-functional changes, which might not ever appear on a board for company-wide items. You can go crazy with this, however; the speaker described one case where something like 36 boards were in use.

This session, like many presentations on development process, tended to presume that development throughput was a bottleneck in the company. This is often the case, but not always. What to do when development is not the bottleneck is a subject which could use fuller treatment.

Understanding User Experience Patterns

Since the original notion of a "design pattern" comes from Christopher Alexander’s writings on architecture (see Patterns of Software, by Richard P. Gabriel, for more info on this), it makes sense that software companies would want to apply design patterns to more than just code structure. Although there are a number of online user experience pattern catalogs, it still strikes me that this is an area where we, as an industry, have a lot to learn.

I very much enjoyed Ambrose Little’s presentation on UX patterns. He showed examples of good and bad interfaces, and discussed why they succeed or fail. He then tied those reasons into pattern catalogs, and demonstrated several of the online catalogs and discussed their strengths and weaknesses.

jQuery 1.4: What You Need to Know

For some reason, the lunchtime sessions were not in the Stir Trek catalog, so I will link Matt’s slides instead. Matt used a lightweight framework to display his slides using HTML and JavaScript instead of a tool like PowerPoint. This allowed him to demonstrate jQuery features right in the slides. It’s a very effective way of presenting his subject matter. There wasn’t a lot of new material in this presentation, given that jQuery 1.4 has been out for a while. It was a good overview, though.

Is Mobile Development Going to Follow the Book of Jobs (Steve That Is)?

This presentation was a lot like its title. Opinionated and verbose, but with an attempt to keep things fun the whole time. The presenter has been working in the mobile space for a long time, and has more than his share of war stories. Like a lot of people in mobile work, though, it seems to me that his opinions were colored by the specific nature of the work his company does. The speaker seemed to treat browser apps and web apps as the same thing. "Native" apps can be web apps. Browser apps can be local. Web app doesn’t necessarily mean "in the browser." HTML/JS isn’t necessarily a web app, especially in the mobile space. Overall, though, I enjoyed this a lot, though I’m not sure I’m going to take practical info home with me.

JQueryUI – The Magic From Behind The Curtain

Watching this presentation was a bit like playing with the jQuery UI demo page. Still, it exposed me to some features that I haven’t seen before. The presenter kept things fun, and I left the session feeling like I’ve learned something.

Conclusion

The Stir Trek organizers, who, as far as I know, are all volunteers, did an amazing job creating an event for 600 people that cost so little and delivered so much value. I haven’t even discussed the freebies like the O’Reilly e-book and the discounts on training, etc. Don’t miss this conference next year!

Tagged , , , , , ,

In LINQ, Don’t Use Count() When You Mean Any()

If you have a list, array, or query in a C#/LINQ application and need to check and see if the list is empty, the correct way to do this is to use the Any() extension method:

if (q.Any())
{

Similarly, you can check to see if any elements in the list meet a certain condition:

if (q.Any(i => i.IsSpecial))
{

If the query provider is something like LINQ to Entities, this will be translated into fairly efficient SQL using EXISTS.

For some reason, I see a lot of people write this code using the Count() extension method instead (maybe they don’t know about Any()?), like this:

if (q.Count() > 0)
{

This is wrong for two reasons:

  • It’s imperative instead of expressive. Using Any() tells the query provider, "Please determine if the list is non-empty using the most efficient way you can." Using Count() > 0 tells the query provider, "Please do exactly what I tell you, regardless of what I really need." Because LINQ is intended to support a variety of query providers, it is important to be expressive instead of imperative, and to let the provider specialize the implementation.
  • Because we don’t actually care about the exact count of items in the list, only that it is greater than zero, using the Count() function can cause the provider to do considerably more work than necessary. Consider a linked list, or a SQL-based provider.
Tagged , ,

A Math Primer for Gentry’s Fully Homomorphic Encryption

A couple of weeks ago, I wrote What Is Homomorphic Encryption, and Why Should I Care? In that post, I promised to share my C# implementation of the algorithm from Craig Gentry’s CACM article. Before I can do that, though, I need to explain some of the math involved.

Perhaps surprisingly, it’s actually very simple. (I say "surprisingly" because much of the math and technical papers on encryption is decidedly not simple, including that of Gentry’s first fully homomorphic scheme, which was based on ideal lattices.)

This scheme created by Marten van Dijk, Craig Gentry, Shai Halevi and Vinod Vaikuntanathan, however, uses basic arithmetic operations like division, with a few uncommon, but easy to understand, variations.

The nature of homomorphic encryption also dictates a programming style which will seem unfamiliar to users of most high-level languages, but very familiar to anyone who has ever taken a digital circuits class.

Integer Division

What is the integer quotient of 10 / 6? Most people would probably say "1, remainder 4." But the exact answer, in the domain of real numbers, is 1.666666 (repeating), which is closer to 2 than the previous answer of 1. So another way we could answer this question is "2, remainder -2." This quotient is closer to the exact answer, and, correspondingly, has a smaller remainder.

So which answer is correct? Arguably, both of them. As long as the following rule holds:

dividend = divisor * quotient + remainder (the division rule)

…then we have a valid answer.

Which method should you use? It depends on why you’re doing the division. If you’re computing how many cupcakes each child can have at a birthday party, then you’d better use the answer with the positive remainder. If you’re computing how many panels of fencing you need to surround your yard, then you’d better use the answer with the negative remainder.

In fact, there are at least five different, valid algorithms for selecting a quotient and remainder for a given integer division problem.

The homomorphic encryption scheme used in the van Dijk, et. al. paper and in Gentry’s CACM article uses "R-division":

  1. Compute the real quotient QR.
  2. Compute the integer quotient QZ by rounding QR to the closest integer.
  3. Compute the remainder R = Dividend - Divisor * QZ

This is probably different than the method you learned in elementary school, but both are valid. Importantly, it’s probably different than what the integer division and remainder operators in your favorite programming language do.

Modular Arithmetic

If you’ve ever seen a 12 hour, analog clock, then you’ve worked with modular arithmetic. The time of 10:00 today is the same position on the clock as 10:00 p.m/22:00. Another way to say this is:

10 ≡ 22 mod 12

This reads: "10 is congruent to 22 modulo 12." In other words, we just ignore the "extra" 12 hours in the measurement of 22:00, because it’s the same clock dial position as 22:00, only with a circle around the dial.

Naturally, we can perform arithmetic operations like addition and subtraction and compare the congruence of the result. I can say "10:00 + 5 hours means that the hour hand will point to 3 on the clock," or:

10 + 5 ≡ 3 mod 12

Modulo 2 Arithmetic and Binary Operations

You can use any number as the modulus. When we make analog clocks, we use 12. A modulus which is particularly interesting in computer programming is 2. Arithmetic operations mod 2 correspond to binary operations, e.g.:

0 + 0 ≡ 0 mod 2
0 + 1 ≡ 1 mod 2
1 + 0 ≡ 1 mod 2
1 + 1 ≡ 0 mod 2

From this example, you can see that addition modulo 2 is the same as the binary operation XOR. It turns out that subtraction is exactly the same thing (for mod 2 only!):

0 - 0 ≡ 0 mod 2
0 - 1 ≡ 1 mod 2
1 - 0 ≡ 1 mod 2
1 - 1 ≡ 0 mod 2

Multiplication modulo 2, on the other hand, corresponds to the binary operation AND:

0 * 0 ≡ 0 mod 2
0 * 1 ≡ 0 mod 2
1 * 0 ≡ 0 mod 2
1 * 1 ≡ 1 mod 2

Mod in Programming

This is all very simple. However, a word of caution is in order here for anyone who has used a high-level programming language. Most languages have an operator like mod (in Delphi) or % (in C#, which is commonly pronounced "mod"). However, this operator is not strictly modular congruence. It is more like a remainder, although, as we’ve seen, different people and different programming languages might choose to compute a remainder in different (but hopefully valid) ways.

Remainders and congruence are often the same. In fact, the congruence relationship and the integer division remainder for the examples above are all the same. For example:

10 ≡ 22            mod 12
22 / 12 = 1 R 10

However, it’s easy to show examples where this is not true:

22 ≡ 34              mod 12       (1)
34 / 12 = 2 R 10                  (2)
-22 ≡ 2              mod 12       (3)
-22 / 12 = -1 R -10               (4)

(1) is probably not the most common choice; 10 would be a more common answer, as with (2). (1) is nevertheless correct as a statement of congruence. Now compare (3) with (4). The most common way to compute a modulus is to pick the smallest positive number. But the most common way to perform integer division is so-called "T-division", where you select the quotient closest to zero and then calculate the remainder, resulting in a negative remainder when either the dividend or the divisor is negative.

Programs as Digital Circuits

A homomorphic encryption scheme, in addition to the usual Encrypt and Decrypt and KeyGen functions, has an Evaluate function which performs operations on the ciphertext, resulting in the ciphertext of the result of the function.

Obviously, this necessitates a different style of programming than that afforded by the typical programming language. In particular, code like this:

bool a = b ? c : d

…(where a, b, c, and d are all bools) is impossible, because the value of b is encrypted, so the program cannot know what to assign to a. If, however, we can perform binary operations on the ciphertext of b, then we can rewrite the statement above as:

bool a = (b & c) | ((!b) & d)

…or its homomorphic encryption equivalent:

CypherText a = (b h_and c) h_or (h_not(b) h_and d)

…where the h_* operators are the homomorphic equivalents of the usual Boolean operations and a, b, c, and d are now of type CypherText.

Note that the version with the ternary operator and the version with the AND and OR operators are not strictly the same, although their results are; the ternary operator is lazy, whereas the AND and OR version uses complete evaluation. This is necessary when the values are encrypted. It also means that the function may be inefficient.

Intuitively, it’s easy to see that any referentially transparent function can be reduced to such operations; this is what compilers and operating systems do under the hood anyway. I’m not going to go into any detail on how this is done; get an introduction to digital circuits book if you are interested in the particulars.

Gentry’s article notes that other changes in programming style are necessary when performing operations within a homomorphic encryption scheme. For example, the size of the output of a function must be set in advance. Even if the plaintext is variable-length, the ciphertext must be of a known length, which corresponds to the number of "wires" in the circuit. The plaintext, therefore, would have "whitespace" at the end or be truncated, depending upon its size.

Minimizing Boolean Functions

In my first post on homomorphic encryption, I mentioned that Gentry’s encryption schemes can be considered fully homomorphic because they support two homomorphic operations, corresponding to Boolean AND and XOR. I’d like to go into a little bit more detail as to why that is true.

Many combinations of Boolean operations are equivalent. Perhaps the most famous are De Morgan’s laws. There are a variety of techniques for converting one function using Boolean operations into an equivalent function with different operations. This is often done in order to produce a simpler or more efficient function, but can also be done in order to use a specific type of Boolean gate.

It is possible to use combinations of NAND or NOR gates, for example, to produce circuits which perform a Boolean AND, OR, NOT, etc. Hence, a cryptosystem which supported a homomorphic NAND operation could be considered "fully homomorphic."

Similarly, having both AND and XOR gates available allows you to produce the same outputs as all other Boolean gates, as, for example, NOT p is the same as p XOR 1 and we can see by De Morgan’s laws that with NOT and AND we can implement OR.

Therefore, we can see that a cryptosystem can be considered fully homomorphic if it supports enough homomorphic operations to perform any logical Boolean operation. In particular, a cryptosystem which supports any of the following homomorphic operations would qualify:

  • Just NAND
  • Just NOR
  • Both XOR and AND

What’s Next

If you understand the math above, you should now be able to follow along as I implement Gentry’s algorithm for "somewhat homomorphic" encryption. As you’ll see, the "somewhat homomorphic" encryption will be the first step towards a fully homomorphic cryptosystem.

Tagged , , ,

Want to Beta Test the Next Version of InterBase?

The InterBase roadmap says that the next version will probably include native 64 bit and Windows 7 support, cloud deployment, and enhance password security. Want to help beta test it? You can sign up now.

Tagged

What is Homomorphic Encryption, and Why Should I Care?

The March 2010 issue of the Communications of the ACM includes a technical paper with an introduction entitled "A First Glance of Cryptography’s Holy Grail" (ACM subscription required). That’s enough to catch my attention. The paper itself, Computing Arbitrary Functions of Encrypted Data, describes a relatively new algorithm for homomorphic encryption.

Although these words may be unfamiliar to many, the subject matter is terribly important, because, like public-key encryption, which paved the way for secure transactions over the web, an efficient and fully homomorphic encryption scheme would enable new kinds of distributed computing. I’ll explain more about this in a little bit.

If you have an ACM membership, or can find the magazine in a library, I recommend the article. It is far and away more readable than the technical papers on the same subject which are available on the web. The article uses a running analogy of a jeweler who doesn’t quite trust her employees in order to help the reader understand the design of the system.

What Is Homomorphic Encryption?

"Homomorphic" is an adjective which describes a property of an encryption scheme. That property, in simple terms, is the ability to perform computations on the ciphertext without decrypting it first. Because this tends to sound either baffling or miraculous the first time you hear it, let’s begin with a very simple example.

The popular but wildly insecure cipher scheme rot-13 (a.k.a. "Caesar cipher") is partially homomorphic, specifically with respect to the concatenation operation. Imagine we write an Encrypt and Decrypt function using the rot-13 algorithm. The "secret key" will be 13, the number of characters each letter is shifted. Let’s encrypt two words and then concatenate the ciphertext, and finally decrypt the result. In psuedocode, this is:

var c1 = Encrypt(13, "HELLO");      // c1 = URYYB
var c2 = Encrypt(13, "WORLD");      // c2 = JBEYQ
var c3 = Concat (c1, c2);           // c3 = URYYBJBEYQ
var p  = Decrypt(13, c3);           // p  = HELLOWORLD

Because it was not necessary to first decrypt the two fragments of ciphertext before performing the concatenation operation, we can say that rot-13 is homomorphic with respect to concatenation.  In other words, it is possible to take two pieces of ciphertext and perform an operation on them which results in the ciphertext of the concatenation of the two respective pieces of plaintext.

Visually, it looks like this:

Homomorphic concat with Rot-13

It just so happens that in this case the homomorphic concatenation (concatenating the two fragments of ciphertext) is the same operation as the non-homomorphic concatenation (concatenating two fragments of plaintext). This is not always the case. What is important is that we can perform some operation on the input ciphertext which will produce new ciphertext that, when decrypted, will produce output plaintext corresponding to a desired operation on the input plaintext.

Although rot-13 is not at all secure, it turns out that some cryptosystems widely believed to be secure have homomorphic properties. For example, "pure" and un-padded RSA is homomorphic with respect to multiplication.

Why Should I Care?

All of this may seem academically interesting, but one might wonder why I started this post claiming that "an efficient and fully homomorphic encryption scheme would enable new kinds of distributed computing."

I think that the scenario which best makes the benefits of homomorphic encryption clear is cloud computing. It is often much more economical to buy computing resources from a cloud provider than to build a data center yourself. This is especially true if your need for computing horsepower fluctuates. But what if you want to do this computing on private data? Maybe you trust your cloud provider, but what if trust is not enough? Is there a way to get the compelling economic benefits of cloud computing while keeping your data secure?

Imagine that you have developed a web application for income tax preparation. Your application collects personal and financial information from the user, creates a tax strategy resulting in the lowest possible (legal!) income tax payment, and submits the prepared return to the IRS. From a business point of view, this application might be compelling, but it’s a daunting task operationally. In the United States, most people file their taxes once a year, before April 15th. This means that your servers will see a huge spike in demand in the first quarter of the year, with relatively little demand other times. Also, potential customers might be understandably wary about uploading their personal information and financial data to the website of a new business.

Cloud computing offers an excellent answer to the first problem. Because you buy computing resources on as-needed basis, it is very easy to increase the number of available servers when tax season arrives, and reduce the number at other times. Unfortunately, it doesn’t do anything for the second problem.

Hard security in the cloud is not really possible today. It’s very easy to have secure transmission from a local machine to a cloud data store, and of course the stored data can be encrypted. But actually performing computations on that data in the cloud requires decrypting it first. Anyone with physical access to the machine, therefore, has access to your data.

What if it were possible for a user of your tax preparation software to upload their financial information encrypted under the IRS’s public key? Then their data would be secure. You can do this today, of course, but your software would be unable to select a tax strategy for the user or prepare forms. If, however, the encryption method used was also fully homomorphic, then your software could do all of this work without first decrypting the user’s information. The output of your software would be a tax return encrypted under the IRS’s public key. Only the IRS could decrypt it.

Fully Homomorphic Encryption

So a fully homomorphic encryption scheme would seem to solve the security problem while still being compatible with a cloud deployment scenario. Unfortunately, preparing a tax return requires more than just a Concat operation. We can say that an encryption scheme is "fully homomorphic" if it supports enough homomorphic operations to implement any function we need. I’m being purposely imprecise here, because the details are a bit of a digression at this point.

Although there are a number of encryption schemes with one homomorphic operation, until recently no one was really sure if fully homomorphic encryption was even possible. Rivest, Adleman, and Dertouzos suggested that fully homomorphic encryption may be possible in 1978, but were unable to find a secure scheme. Another scheme, from Boneh, et. al., supports two operations, but you can only perform one of them once.

When you consider the complexity of a typical programming language, two operations doesn’t sound like very many, but since we are only looking at operations which mutate data (as opposed to keeping track of the current instruction pointer, etc.) it turns out that supporting the and and xor operations is enough to consider a scheme fully homomorphic, if you can perform those operations an unlimited number of times.

So it was big news when Craig Gentry managed to create such a scheme as part of his Stanford doctoral thesis. Gentry, along with several other researchers from IBM and MIT later created yet another scheme using a different encryption technique, but a similar general approach, with similar homomorphic properties.

Some would say "too big." Bruce Schneier criticized the IBM press release for implying, in his reading, that Gentry’s scheme was practical for real applications, today. It isn’t; the computational and data storage overheads are far too high. However, this takes nothing away from Gentry’s achievement; he has shown that fully homomorphic encryption is actually possible. Indeed, Schneier concludes:

Visions of a fully homomorphic cryptosystem have been dancing in cryptographers’ heads for thirty years. I never expected to see one. It will be years before a sufficient number of cryptographers examine the algorithm that we can have any confidence that the scheme is secure, but — practicality be damned — this is an amazing piece of work.

Let’s Code It!

The second, fully homomorphic scheme proposed by Gentry, et al., and described in the CACM article is simple enough that I decided to implement it myself. I’ve learned quite a lot in the process of doing this. So in the near future I’ll be sharing my code and some of the insights I’ve made in this process.

Before I can do that, however, I need to describe some of the math involved. And I’d like to elaborate on why two operations is enough to consider a scheme "fully homomorphic."

(Continue reading…)

Tagged , , , ,

Bad Behavior has blocked 713 access attempts in the last 7 days.

Close