KEYS: Implement encrypt, decrypt and sign for software asymmetric key
authorDavid Howells <dhowells@redhat.com>
Thu, 1 Sep 2016 10:13:13 +0000 (11:13 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 1 Sep 2016 10:13:13 +0000 (11:13 +0100)
commit3a8b45d6dfc177fe123594bc12679f1827992a27
treefc6ed39e26400e33d266d89a09cf491ad91331a5
parentb19b107b3dc35c9f442392957e39d28172a88e35
KEYS: Implement encrypt, decrypt and sign for software asymmetric key

Implement the encrypt, decrypt and sign operations for the software
asymmetric key subtype.  This mostly involves offloading the call to the
crypto layer.

Note that the decrypt and sign operations require a private key to be
supplied.  Encrypt (and also verify) will work with either a public or a
private key.  A public key can be supplied with an X.509 certificate and a
private key can be supplied using a PKCS#8 blob:

# j=`openssl pkcs8 -in ~/pkcs7/firmwarekey2.priv -topk8 -nocrypt -outform DER | keyctl padd asymmetric foo @s`
# keyctl pkey_query $j - enc=pkcs1
key_size=4096
max_data_size=512
max_sig_size=512
max_enc_size=512
max_dec_size=512
encrypt=y
decrypt=y
sign=y
verify=y
# keyctl pkey_encrypt $j 0 data enc=pkcs1 >/tmp/enc
# keyctl pkey_decrypt $j 0 /tmp/enc enc=pkcs1 >/tmp/dec
# cmp data /tmp/dec
# keyctl pkey_sign $j 0 data enc=pkcs1 hash=sha1 >/tmp/sig
# keyctl pkey_verify $j 0 data /tmp/sig enc=pkcs1 hash=sha1
#

Signed-off-by: David Howells <dhowells@redhat.com>
crypto/asymmetric_keys/public_key.c
This page took 0.024381 seconds and 5 git commands to generate.