#ifndef _OPENSSH_CODING_H_
#define _OPENSSH_CODING_H_
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <Security/cssmtype.h>
#include <security_cdsa_utilities/cssmdata.h>
#include <CoreFoundation/CFData.h>
#ifdef __cplusplus
extern "C" {
#endif
void appendUint32(
CFMutableDataRef cfOut,
uint32_t ui);
uint32_t readUint32(
const unsigned char *&cp, unsigned &len);
extern CSSM_RETURN RSAPublicKeyEncodeOpenSSH1(
RSA *openKey,
const CssmData &descData,
CssmOwnedData &encodedKey);
extern CSSM_RETURN RSAPublicKeyDecodeOpenSSH1(
RSA *openKey,
void *p,
size_t length);
extern CSSM_RETURN RSAPrivateKeyEncodeOpenSSH1(
RSA *openKey,
const CssmData &descData,
CssmOwnedData &encodedKey);
extern CSSM_RETURN RSAPrivateKeyDecodeOpenSSH1(
RSA *openKey,
void *p,
size_t length);
extern CSSM_RETURN RSAPublicKeyEncodeOpenSSH2(
RSA *openKey,
const CssmData &descData,
CssmOwnedData &encodedKey);
extern CSSM_RETURN RSAPublicKeyDecodeOpenSSH2(
RSA *openKey,
void *p,
size_t length);
extern CSSM_RETURN DSAPublicKeyEncodeOpenSSH2(
DSA *openKey,
const CssmData &descData,
CssmOwnedData &encodedKey);
extern CSSM_RETURN DSAPublicKeyDecodeOpenSSH2(
DSA *openKey,
void *p,
size_t length);
extern CSSM_RETURN encodeOpenSSHv1PrivKey(
RSA *r,
const uint8 *comment,
unsigned commentLen,
const uint8 *encryptKey,
CFDataRef *encodedKey);
extern CSSM_RETURN decodeOpenSSHv1PrivKey(
const unsigned char *encodedKey,
unsigned encodedKeyLen,
RSA *r,
const uint8 *decryptKey,
uint8 **comment,
unsigned *commentLen);
#ifdef __cplusplus
}
#endif
#endif