Renamed key_encod{ing,der}_t and constants, prepare for generic credential encoding

This commit is contained in:
Martin Willi
2010-07-13 11:29:35 +02:00
parent 24d327ab4d
commit da9724e6d0
55 changed files with 358 additions and 359 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
*/
static int gen()
{
key_encoding_type_t form = KEY_PRIV_ASN1_DER;
cred_encoding_type_t form = PRIVKEY_ASN1_DER;
key_type_t type = KEY_RSA;
u_int size = 0;
private_key_t *key;
+6 -6
View File
@@ -99,11 +99,11 @@ static int keyid()
if (type == CRED_PRIVATE_KEY)
{
private = cred;
if (private->get_fingerprint(private, KEY_ID_PUBKEY_SHA1, &id))
if (private->get_fingerprint(private, KEYID_PUBKEY_SHA1, &id))
{
printf("subjectKeyIdentifier: %#B\n", &id);
}
if (private->get_fingerprint(private, KEY_ID_PUBKEY_INFO_SHA1, &id))
if (private->get_fingerprint(private, KEYID_PUBKEY_INFO_SHA1, &id))
{
printf("subjectPublicKeyInfo hash: %#B\n", &id);
}
@@ -112,11 +112,11 @@ static int keyid()
else if (type == CRED_PUBLIC_KEY)
{
public = cred;
if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &id))
if (public->get_fingerprint(public, KEYID_PUBKEY_SHA1, &id))
{
printf("subjectKeyIdentifier: %#B\n", &id);
}
if (public->get_fingerprint(public, KEY_ID_PUBKEY_INFO_SHA1, &id))
if (public->get_fingerprint(public, KEYID_PUBKEY_INFO_SHA1, &id))
{
printf("subjectPublicKeyInfo hash: %#B\n", &id);
}
@@ -131,11 +131,11 @@ static int keyid()
fprintf(stderr, "extracting public key from certificate failed");
return 1;
}
if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &id))
if (public->get_fingerprint(public, KEYID_PUBKEY_SHA1, &id))
{
printf("subjectKeyIdentifier: %#B\n", &id);
}
if (public->get_fingerprint(public, KEY_ID_PUBKEY_INFO_SHA1, &id))
if (public->get_fingerprint(public, KEYID_PUBKEY_INFO_SHA1, &id))
{
printf("subjectPublicKeyInfo hash: %#B\n", &id);
}
+2 -2
View File
@@ -30,11 +30,11 @@ static void print_pubkey(public_key_t *key)
printf("pubkey: %N %d bits\n", key_type_names, key->get_type(key),
key->get_keysize(key) * 8);
if (key->get_fingerprint(key, KEY_ID_PUBKEY_INFO_SHA1, &chunk))
if (key->get_fingerprint(key, KEYID_PUBKEY_INFO_SHA1, &chunk))
{
printf("keyid: %#B\n", &chunk);
}
if (key->get_fingerprint(key, KEY_ID_PUBKEY_SHA1, &chunk))
if (key->get_fingerprint(key, KEYID_PUBKEY_SHA1, &chunk))
{
printf("subjkey: %#B\n", &chunk);
}
+1 -1
View File
@@ -23,7 +23,7 @@
*/
static int pub()
{
key_encoding_type_t form = KEY_PUB_SPKI_ASN1_DER;
cred_encoding_type_t form = PUBKEY_SPKI_ASN1_DER;
credential_type_t type = CRED_PRIVATE_KEY;
int subtype = KEY_RSA;
certificate_t *cert;
+4 -4
View File
@@ -21,20 +21,20 @@
/**
* Convert a form string to a encoding type
*/
bool get_form(char *form, key_encoding_type_t *type, bool pub)
bool get_form(char *form, cred_encoding_type_t *type, bool pub)
{
if (streq(form, "der"))
{
/* der encoded keys usually contain the complete SubjectPublicKeyInfo */
*type = pub ? KEY_PUB_SPKI_ASN1_DER : KEY_PRIV_ASN1_DER;
*type = pub ? PUBKEY_SPKI_ASN1_DER : PRIVKEY_ASN1_DER;
}
else if (streq(form, "pem"))
{
*type = pub ? KEY_PUB_PEM : KEY_PRIV_PEM;
*type = pub ? PUBKEY_PEM : PRIVKEY_PEM;
}
else if (streq(form, "pgp"))
{
*type = pub ? KEY_PUB_PGP : KEY_PRIV_PGP;
*type = pub ? PUBKEY_PGP : PRIVKEY_PGP;
}
else
{
+1 -1
View File
@@ -29,7 +29,7 @@
/**
* Convert a form string to a encoding type
*/
bool get_form(char *form, key_encoding_type_t *type, bool pub);
bool get_form(char *form, cred_encoding_type_t *type, bool pub);
/**
* Convert a digest string to a hash algorithm