diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2009-07-21 11:16:54 -0700 |
|---|---|---|
| committer | Jean-Baptiste Queru <jbq@google.com> | 2009-07-21 11:16:54 -0700 |
| commit | cf4550c3198d6b3d92cdc52707fe70d7cc0caa9f (patch) | |
| tree | 6510f35ad004f1a4640b48264c290926e8596d7a /keystore/jni/cert.h | |
| parent | 4cf03d381b2dff908857fceff0bec445f8d44f36 (diff) | |
| download | frameworks_base-cf4550c3198d6b3d92cdc52707fe70d7cc0caa9f.zip frameworks_base-cf4550c3198d6b3d92cdc52707fe70d7cc0caa9f.tar.gz frameworks_base-cf4550c3198d6b3d92cdc52707fe70d7cc0caa9f.tar.bz2 | |
donut snapshot
Diffstat (limited to 'keystore/jni/cert.h')
| -rw-r--r-- | keystore/jni/cert.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/keystore/jni/cert.h b/keystore/jni/cert.h new file mode 100644 index 0000000..a9807b1 --- /dev/null +++ b/keystore/jni/cert.h @@ -0,0 +1,59 @@ +/* +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +#ifndef __CERT_H__ +#define __CERT_H__ + +#define ANDROID_KEYSTORE "Android Keystore" +#define KEYGEN_STORE_SIZE 5 +#define KEYLENGTH_MEDIUM 1024 +#define KEYLENGTH_MAXIMUM 2048 +#define MAX_CERT_NAME_LEN 128 +#define MAX_PEM_LENGTH 4096 +#define REPLY_MAX MAX_PEM_LENGTH + + +#define STR(token) #token +#define ERR_INVALID_KEY_LENGTH 1 +#define ERR_CONSTRUCT_NEW_DATA 2 +#define ERR_RSA_KEYGEN 3 +#define ERR_X509_PROCESS 4 +#define ERR_BIO_READ 5 +#define ERR_MAXIMUM 6 + +typedef struct { + EVP_PKEY *pkey; + unsigned char *public_key; + int key_len; +} PKEY_STORE; + +#define PKEY_STORE_free(x) { \ + if(x.pkey) EVP_PKEY_free(x.pkey); \ + if(x.public_key) free(x.public_key); \ +} + +#define nelem(x) (sizeof (x) / sizeof *(x)) + +int gen_csr(int bits, const char *organizations, char reply[REPLY_MAX]); +int is_pkcs12(const char *buf, int bufLen); +X509* parse_cert(const char *buf, int bufLen); +int get_cert_name(X509 *cert, char *buf, int size); +int get_issuer_name(X509 *cert, char *buf, int size); +int is_ca_cert(X509 *cert); +int get_private_key_pem(X509 *cert, char *buf, int size); + +#endif |
