imgtool: add option to export public PEM

Update `getpub` with new `lang` option, "pem", which allows exporting a
public key as a PEM file. This can later be distributed to be used for
encrypting an image, and gets away with having to use openssl for this
step.

Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/docs/encrypted_images.md b/docs/encrypted_images.md
index 6ce52f1..2cdcdc3 100644
--- a/docs/encrypted_images.md
+++ b/docs/encrypted_images.md
@@ -153,7 +153,8 @@
 
 To extract the public key in source file form, use
 `imgtool getpub -k <input.pem> -l <lang>`, where lang can be one of `c` or
-`rust` (defaults to `c`).
+`rust` (defaults to `c`). To extract a public key in PEM form, use
+`imgtool getpub -k <input.pem> -l pem`.
 
 If using AES-KW, follow the steps in the next section to generate the
 required keys.