#ifndef _CRYPTKIT_DER_H_
#define _CRYPTKIT_DER_H_
#include <security_cryptkit/ckconfig.h>
#include <security_cryptkit/feeTypes.h>
#include <security_cryptkit/feePublicKey.h>
#include <security_cryptkit/giantIntegers.h>
#include <security_cryptkit/falloc.h>
#include <security_cryptkit/curveParams.h>
#ifdef __cplusplus
extern "C" {
#endif
feeReturn feeDEREncodeElGamalSignature(
giant u,
giant PmX,
unsigned char **encodedSig, unsigned *encodedSigLen);
feeReturn feeDEREncodeECDSASignature(
giant c,
giant d,
unsigned char **encodedSig, unsigned *encodedSigLen);
feeReturn feeDERDecodeElGamalSignature(
const unsigned char *encodedSig,
size_t encodedSigLen,
giant *u, giant *PmX);
feeReturn feeDERDecodeECDSASignature(
const unsigned char *encodedSig,
size_t encodedSigLen,
giant *c, giant *d);
feeReturn feeRAWEncodeECDSASignature(
unsigned groupBytesLen,
giant c,
giant d,
unsigned char **encodedSig, unsigned *encodedSigLen);
feeReturn feeRAWDecodeECDSASignature(
unsigned groupBytesLen,
const unsigned char *encodedSig,
size_t encodedSigLen,
giant *c, giant *d);
feeReturn feeDEREncodePublicKey(
int version,
const curveParams *cp,
giant plusX,
giant minusX,
giant plusY, unsigned char **keyBlob, unsigned *keyBlobLen);
feeReturn feeDEREncodePrivateKey(
int version,
const curveParams *cp,
const giant privData,
unsigned char **keyBlob, unsigned *keyBlobLen);
feeReturn feeDERDecodePublicKey(
const unsigned char *keyBlob,
unsigned keyBlobLen,
int *version, curveParams **cp,
giant *plusX,
giant *minusX,
giant *plusY);
feeReturn feeDERDecodePrivateKey(
const unsigned char *keyBlob,
unsigned keyBlobLen,
int *version, curveParams **cp,
giant *privData);
unsigned feeSizeOfDERSig(
giant g1,
giant g2);
feeReturn feeDEREncodeX509PublicKey(
const unsigned char *pubBlob,
unsigned pubBlobLen,
curveParams *cp,
unsigned char **x509Blob,
unsigned *x509BlobLen);
feeReturn feeDERDecodeX509PublicKey(
const unsigned char *x509Blob,
unsigned x509BlobLen,
feeDepth *depth,
unsigned char **pubBlob,
unsigned *pubBlobLen);
feeReturn feeDEREncodeOpenSSLPrivateKey(
const unsigned char *privBlob,
unsigned privBlobLen,
const unsigned char *pubBlob,
unsigned pubBlobLen,
curveParams *cp,
unsigned char **openBlob,
unsigned *openBlobLen);
feeReturn feeDERDecodeOpenSSLKey(
const unsigned char *osBlob,
unsigned osBlobLen,
feeDepth *depth,
unsigned char **privBlob,
unsigned *privBlobLen,
unsigned char **pubBlob,
unsigned *pubBlobLen);
feeReturn feeDEREncodePKCS8PrivateKey(
const unsigned char *privBlob,
unsigned privBlobLen,
const unsigned char *pubBlob,
unsigned pubBlobLen,
curveParams *cp,
unsigned char **pkcs8Blob,
unsigned *pkcs8BlobLen);
feeReturn feeDERDecodePKCS8PrivateKey(
const unsigned char *pkcs8Blob,
unsigned pkcs8BlobLen,
feeDepth *depth,
unsigned char **privBlob,
unsigned *privBlobLen,
unsigned char **pubBlob,
unsigned *pubBlobLen);
#ifdef __cplusplus
}
#endif
#endif