mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 00:46:17 +08:00
fix BOOL bug in sgd.h
This commit is contained in:
@@ -785,8 +785,8 @@ libcrypto.pc:
|
|||||||
echo 'includedir=$${prefix}/include'; \
|
echo 'includedir=$${prefix}/include'; \
|
||||||
echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
|
echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo 'Name: OpenSSL-libcrypto'; \
|
echo 'Name: GmSSL-libcrypto'; \
|
||||||
echo 'Description: OpenSSL cryptography library'; \
|
echo 'Description: GmSSL cryptography library'; \
|
||||||
echo 'Version: '$(VERSION); \
|
echo 'Version: '$(VERSION); \
|
||||||
echo 'Libs: -L$${libdir} -lcrypto'; \
|
echo 'Libs: -L$${libdir} -lcrypto'; \
|
||||||
echo 'Libs.private: $(EX_LIBS)'; \
|
echo 'Libs.private: $(EX_LIBS)'; \
|
||||||
@@ -798,7 +798,7 @@ libssl.pc:
|
|||||||
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
|
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
|
||||||
echo 'includedir=$${prefix}/include'; \
|
echo 'includedir=$${prefix}/include'; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo 'Name: OpenSSL-libssl'; \
|
echo 'Name: GmSSL-libssl'; \
|
||||||
echo 'Description: Secure Sockets Layer and cryptography libraries'; \
|
echo 'Description: Secure Sockets Layer and cryptography libraries'; \
|
||||||
echo 'Version: '$(VERSION); \
|
echo 'Version: '$(VERSION); \
|
||||||
echo 'Requires.private: libcrypto'; \
|
echo 'Requires.private: libcrypto'; \
|
||||||
@@ -812,7 +812,7 @@ openssl.pc:
|
|||||||
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
|
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
|
||||||
echo 'includedir=$${prefix}/include'; \
|
echo 'includedir=$${prefix}/include'; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo 'Name: OpenSSL'; \
|
echo 'Name: GmSSL'; \
|
||||||
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
|
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
|
||||||
echo 'Version: '$(VERSION); \
|
echo 'Version: '$(VERSION); \
|
||||||
echo 'Requires: libssl libcrypto' ) > openssl.pc
|
echo 'Requires: libssl libcrypto' ) > openssl.pc
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ $config{shlib_version_history} = "unknown";
|
|||||||
|
|
||||||
collect_information(
|
collect_information(
|
||||||
collect_from_file(catfile($srcdir,'include/openssl/opensslv.h')),
|
collect_from_file(catfile($srcdir,'include/openssl/opensslv.h')),
|
||||||
qr/OPENSSL.VERSION.TEXT.*OpenSSL (\S+) / => sub { $config{version} = $1; },
|
qr/OPENSSL.VERSION.TEXT.*GmSSL (\S+) / => sub { $config{version} = $1; },
|
||||||
qr/OPENSSL.VERSION.NUMBER.*(0x\S+)/ => sub { $config{version_num}=$1 },
|
qr/OPENSSL.VERSION.NUMBER.*(0x\S+)/ => sub { $config{version_num}=$1 },
|
||||||
qr/SHLIB_VERSION_NUMBER *"([^"]+)"/ => sub { $config{shlib_version_number}=$1 },
|
qr/SHLIB_VERSION_NUMBER *"([^"]+)"/ => sub { $config{shlib_version_number}=$1 },
|
||||||
qr/SHLIB_VERSION_HISTORY *"([^"]*)"/ => sub { $config{shlib_version_history}=$1 }
|
qr/SHLIB_VERSION_HISTORY *"([^"]*)"/ => sub { $config{shlib_version_history}=$1 }
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#
|
#
|
||||||
# OpenSSL example configuration file.
|
# GmSSL example configuration file.
|
||||||
# This is mostly being used for generation of certificate requests.
|
# This is mostly being used for generation of certificate requests.
|
||||||
#
|
#
|
||||||
openssl_conf = openssl_init
|
|
||||||
|
|
||||||
# This definition stops the following lines choking if HOME isn't
|
# This definition stops the following lines choking if HOME isn't
|
||||||
# defined.
|
# defined.
|
||||||
@@ -16,7 +15,7 @@ oid_section = new_oids
|
|||||||
# To use this configuration file with the "-extfile" option of the
|
# To use this configuration file with the "-extfile" option of the
|
||||||
# "openssl x509" utility, name here the section containing the
|
# "openssl x509" utility, name here the section containing the
|
||||||
# X.509v3 extensions to use:
|
# X.509v3 extensions to use:
|
||||||
# extensions =
|
# extensions =
|
||||||
# (Alternatively, use a configuration file that has only
|
# (Alternatively, use a configuration file that has only
|
||||||
# X.509v3 extensions in its main [= default] section.)
|
# X.509v3 extensions in its main [= default] section.)
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ serial = $dir]serial. # The current serial number
|
|||||||
crlnumber = $dir]crlnumber. # the current crl number
|
crlnumber = $dir]crlnumber. # the current crl number
|
||||||
# must be commented out to leave a V1 CRL
|
# must be commented out to leave a V1 CRL
|
||||||
crl = $dir]crl.pem # The current CRL
|
crl = $dir]crl.pem # The current CRL
|
||||||
private_key = $dir.private]cakey.pem# The private key
|
private_key = $dir.private]cakey.pem # The private key
|
||||||
RANDFILE = $dir.private].rand # private random number file
|
RANDFILE = $dir.private].rand # private random number file
|
||||||
|
|
||||||
x509_extensions = usr_cert # The extensions to add to the cert
|
x509_extensions = usr_cert # The extensions to add to the cert
|
||||||
@@ -114,7 +113,7 @@ x509_extensions = v3_ca # The extensions to add to the self signed cert
|
|||||||
# input_password = secret
|
# input_password = secret
|
||||||
# output_password = secret
|
# output_password = secret
|
||||||
|
|
||||||
# This sets a mask for permitted string types. There are several options.
|
# This sets a mask for permitted string types. There are several options.
|
||||||
# default: PrintableString, T61String, BMPString.
|
# default: PrintableString, T61String, BMPString.
|
||||||
# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
|
# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
|
||||||
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
|
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
|
||||||
@@ -127,7 +126,7 @@ string_mask = utf8only
|
|||||||
|
|
||||||
[ req_distinguished_name ]
|
[ req_distinguished_name ]
|
||||||
countryName = Country Name (2 letter code)
|
countryName = Country Name (2 letter code)
|
||||||
countryName_default = AU
|
countryName_default = CN
|
||||||
countryName_min = 2
|
countryName_min = 2
|
||||||
countryName_max = 2
|
countryName_max = 2
|
||||||
|
|
||||||
@@ -191,7 +190,7 @@ basicConstraints=CA:FALSE
|
|||||||
keyUsage = keyEncipherment
|
keyUsage = keyEncipherment
|
||||||
|
|
||||||
# This will be displayed in Netscape's comment listbox.
|
# This will be displayed in Netscape's comment listbox.
|
||||||
nsComment = "OpenSSL Generated Certificate"
|
nsComment = "GmSSL Generated Certificate"
|
||||||
|
|
||||||
# PKIX recommendations harmless if included in all certificates.
|
# PKIX recommendations harmless if included in all certificates.
|
||||||
subjectKeyIdentifier=hash
|
subjectKeyIdentifier=hash
|
||||||
@@ -292,7 +291,7 @@ basicConstraints=CA:FALSE
|
|||||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||||
|
|
||||||
# This will be displayed in Netscape's comment listbox.
|
# This will be displayed in Netscape's comment listbox.
|
||||||
nsComment = "OpenSSL Generated Certificate"
|
nsComment = "GmSSL Generated Certificate"
|
||||||
|
|
||||||
# PKIX recommendations harmless if included in all certificates.
|
# PKIX recommendations harmless if included in all certificates.
|
||||||
subjectKeyIdentifier=hash
|
subjectKeyIdentifier=hash
|
||||||
@@ -334,11 +333,11 @@ signer_cert = $dir/tsacert.pem # The TSA signing certificate
|
|||||||
certs = $dir.cacert.pem] # Certificate chain to include in reply
|
certs = $dir.cacert.pem] # Certificate chain to include in reply
|
||||||
# (optional)
|
# (optional)
|
||||||
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
|
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
|
||||||
signer_digest = sha256 # Signing digest to use. (Optional)
|
signer_digest = sm3 # Signing digest to use. (Optional)
|
||||||
default_policy = tsa_policy1 # Policy if request did not specify it
|
default_policy = tsa_policy1 # Policy if request did not specify it
|
||||||
# (optional)
|
# (optional)
|
||||||
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
|
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
|
||||||
digests = sha1, sha256, sha384, sha512 # Acceptable message digests (mandatory)
|
digests = sm3, sha256, sha384, sha512 # Acceptable message digests (mandatory)
|
||||||
accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
|
accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
|
||||||
clock_precision_digits = 0 # number of digits after dot. (optional)
|
clock_precision_digits = 0 # number of digits after dot. (optional)
|
||||||
ordering = yes # Is ordering defined for timestamps?
|
ordering = yes # Is ordering defined for timestamps?
|
||||||
|
|||||||
@@ -56,9 +56,9 @@
|
|||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include "../../e_os.h"
|
#include "../../e_os.h"
|
||||||
|
|
||||||
static long sof_sign_method = SGD_SM2;
|
static SOF_LONG sof_sign_method = SGD_SM2;
|
||||||
static long sof_enc_method = SGD_SM4_CBC;
|
static SOF_LONG sof_enc_method = SGD_SM4_CBC;
|
||||||
static long sof_last_error = SOR_OK;
|
static SOF_LONG sof_last_error = SOR_OK;
|
||||||
static void *sof_app = NULL;
|
static void *sof_app = NULL;
|
||||||
static int sof_user_type = SGD_ROLE_USER;
|
static int sof_user_type = SGD_ROLE_USER;
|
||||||
|
|
||||||
@@ -80,48 +80,48 @@ static int sof_decode(const char *b64, unsigned char **pdata, unsigned int *pdat
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BSTR SOF_GetVersion(void)
|
SOF_BSTR SOF_GetVersion(void)
|
||||||
{
|
{
|
||||||
return OPENSSL_strdup(OpenSSL_version(0));
|
return OPENSSL_strdup(OpenSSL_version(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_SetSignMethod(long SignMethod)
|
SOF_LONG SOF_SetSignMethod(SOF_LONG SignMethod)
|
||||||
{
|
{
|
||||||
sof_sign_method = SignMethod;
|
sof_sign_method = SignMethod;
|
||||||
return SOR_OK;
|
return SOR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_GetSignMethod(void)
|
SOF_LONG SOF_GetSignMethod(void)
|
||||||
{
|
{
|
||||||
return sof_sign_method;
|
return sof_sign_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_SetEncryptMethod(long EncryptMethod)
|
SOF_LONG SOF_SetEncryptMethod(SOF_LONG EncryptMethod)
|
||||||
{
|
{
|
||||||
sof_enc_method = EncryptMethod;
|
sof_enc_method = EncryptMethod;
|
||||||
return SOR_OK;
|
return SOR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_GetEncryptMethod(void)
|
SOF_LONG SOF_GetEncryptMethod(void)
|
||||||
{
|
{
|
||||||
return sof_enc_method;
|
return sof_enc_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list installed client's certificates */
|
/* list installed client's certificates */
|
||||||
BSTR SOF_GetUserList(void)
|
SOF_BSTR SOF_GetUserList(void)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETUSERLIST, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETUSERLIST, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we need an reference to engine */
|
/* we need an reference to engine */
|
||||||
BSTR SOF_ExportUserCert(BSTR ContainerName)
|
SOF_BSTR SOF_ExportUserCert(SOF_BSTR ContainerName)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_EXPORTUSERCERT, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_EXPORTUSERCERT, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_Login(BSTR ContainerName, BSTR PassWd)
|
SOF_BOOL SOF_Login(SOF_BSTR ContainerName, SOF_BSTR PassWd)
|
||||||
{
|
{
|
||||||
unsigned int uiRemainCount;
|
unsigned int uiRemainCount;
|
||||||
int rv;
|
int rv;
|
||||||
@@ -141,13 +141,13 @@ BOOL SOF_Login(BSTR ContainerName, BSTR PassWd)
|
|||||||
return SGD_TRUE;
|
return SGD_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_GetPinRetryCount(BSTR ContainerName)
|
SOF_LONG SOF_GetPinRetryCount(SOF_BSTR ContainerName)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETPINRETRYCOUNT, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETPINRETRYCOUNT, SOF_R_NOT_IMPLEMENTED);
|
||||||
return SOR_NotSupportYetErr;
|
return SOR_NotSupportYetErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_ChangePassWd(BSTR ContainerName, BSTR OldPassWd, BSTR NewPassWd)
|
SOF_BOOL SOF_ChangePassWd(SOF_BSTR ContainerName, SOF_BSTR OldPassWd, SOF_BSTR NewPassWd)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
unsigned int uiRemainCount;
|
unsigned int uiRemainCount;
|
||||||
@@ -169,14 +169,14 @@ BOOL SOF_ChangePassWd(BSTR ContainerName, BSTR OldPassWd, BSTR NewPassWd)
|
|||||||
return SGD_TRUE;
|
return SGD_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_ExportExchangeUserCert(BSTR ContainerName)
|
SOF_BSTR SOF_ExportExchangeUserCert(SOF_BSTR ContainerName)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_EXPORTEXCHANGEUSERCERT, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_EXPORTEXCHANGEUSERCERT, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* `type` defined as SGD_CERT_XXX, SGD_EXT_XXX in sgd.h */
|
/* `type` defined as SGD_CERT_XXX, SGD_EXT_XXX in sgd.h */
|
||||||
BSTR SOF_GetCertInfo(BSTR Base64EncodeCert, short Type)
|
SOF_BSTR SOF_GetCertInfo(SOF_BSTR Base64EncodeCert, SOF_SHORT Type)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
@@ -221,25 +221,25 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetCertInfoByOid(BSTR Base64EncodeCert, BSTR Oid)
|
SOF_BSTR SOF_GetCertInfoByOid(SOF_BSTR Base64EncodeCert, SOF_BSTR Oid)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETCERTINFOBYOID, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETCERTINFOBYOID, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetDeviceInfo(BSTR ContainerName, long Type)
|
SOF_BSTR SOF_GetDeviceInfo(SOF_BSTR ContainerName, SOF_LONG Type)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETDEVICEINFO, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETDEVICEINFO, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_ValidateCert(BSTR Base64EncodeCert)
|
SOF_LONG SOF_ValidateCert(SOF_BSTR Base64EncodeCert)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_VALIDATECERT, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_VALIDATECERT, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_SignData(BSTR ContainerName, BSTR InData)
|
SOF_BSTR SOF_SignData(SOF_BSTR ContainerName, SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
char *b64 = NULL;
|
char *b64 = NULL;
|
||||||
@@ -296,16 +296,16 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_VerifySignedData(BSTR Base64EncodeCert, BSTR InData, BSTR SignValue)
|
SOF_BOOL SOF_VerifySignedData(SOF_BSTR Base64EncodeCert, SOF_BSTR InData, SOF_BSTR SignValue)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_VERIFYSIGNEDDATA, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_VERIFYSIGNEDDATA, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BSTR SOF_SignFile(BSTR ContainerName, BSTR InFile)
|
SOF_BSTR SOF_SignFile(SOF_BSTR ContainerName, SOF_BSTR InFile)
|
||||||
{
|
{
|
||||||
BSTR ret = NULL;
|
SOF_BSTR ret = NULL;
|
||||||
char *b64 = NULL;
|
char *b64 = NULL;
|
||||||
unsigned int uiHashAlgoType = SGD_SM3;
|
unsigned int uiHashAlgoType = SGD_SM3;
|
||||||
unsigned char *pucInData = NULL;
|
unsigned char *pucInData = NULL;
|
||||||
@@ -346,12 +346,12 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_VerifySignedFile(BSTR Base64EncodeCert, BSTR InFile, BSTR SignValue)
|
SOF_BOOL SOF_VerifySignedFile(SOF_BSTR Base64EncodeCert, SOF_BSTR InFile, SOF_BSTR SignValue)
|
||||||
{
|
{
|
||||||
return SGD_FALSE;
|
return SGD_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_EncryptData(BSTR Base64EncodeCert, BSTR InData)
|
SOF_BSTR SOF_EncryptData(SOF_BSTR Base64EncodeCert, SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
@@ -376,13 +376,13 @@ BSTR SOF_EncryptData(BSTR Base64EncodeCert, BSTR InData)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_DecryptData(BSTR ContainerName, BSTR InData)
|
SOF_BSTR SOF_DecryptData(SOF_BSTR ContainerName, SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_DECRYPTDATA, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_DECRYPTDATA, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_EncryptFile(BSTR Base64EncodeCert, BSTR InFile, BSTR OutFile)
|
SOF_BOOL SOF_EncryptFile(SOF_BSTR Base64EncodeCert, SOF_BSTR InFile, SOF_BSTR OutFile)
|
||||||
{
|
{
|
||||||
int ret = SGD_FALSE;
|
int ret = SGD_FALSE;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -415,48 +415,48 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_DecryptFile(BSTR ContainerName, BSTR InFile, BSTR OutFile)
|
SOF_BOOL SOF_DecryptFile(SOF_BSTR ContainerName, SOF_BSTR InFile, SOF_BSTR OutFile)
|
||||||
{
|
{
|
||||||
int ret = SGD_FALSE;
|
int ret = SGD_FALSE;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_SignMessage(short flag, BSTR ContainerName, BSTR InData)
|
SOF_BSTR SOF_SignMessage(SOF_SHORT flag, SOF_BSTR ContainerName, SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_SIGNMESSAGE, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_SIGNMESSAGE, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_VerifySignedMessage(BSTR MessageData, BSTR InData)
|
SOF_BOOL SOF_VerifySignedMessage(SOF_BSTR MessageData, SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_VERIFYSIGNEDMESSAGE, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_VERIFYSIGNEDMESSAGE, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetInfoFromSignedMessage(BSTR SignedMessage, short Type)
|
SOF_BSTR SOF_GetInfoFromSignedMessage(SOF_BSTR SignedMessage, SOF_SHORT Type)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETINFOFROMSIGNEDMESSAGE, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETINFOFROMSIGNEDMESSAGE, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_SignDataXML(BSTR ContainerName, BSTR InData)
|
SOF_BSTR SOF_SignDataXML(SOF_BSTR ContainerName, SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SOF_VerifySignedDataXML(BSTR InData)
|
SOF_BOOL SOF_VerifySignedDataXML(SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_VERIFYSIGNEDDATAXML, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_VERIFYSIGNEDDATAXML, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetXMLSignatureInfo(BSTR XMLSignedData, short Type)
|
SOF_BSTR SOF_GetXMLSignatureInfo(SOF_BSTR XMLSignedData, SOF_SHORT Type)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETXMLSIGNATUREINFO, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETXMLSIGNATUREINFO, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GenRandom(short RandomLen)
|
SOF_BSTR SOF_GenRandom(SOF_SHORT RandomLen)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
char *b64 = NULL;
|
char *b64 = NULL;
|
||||||
@@ -476,78 +476,78 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_GetLastError(void)
|
SOF_LONG SOF_GetLastError(void)
|
||||||
{
|
{
|
||||||
return sof_last_error;
|
return sof_last_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_SetCertTrustList(BSTR CTLAltName, BSTR CTLContent, short CTLContentLen)
|
SOF_LONG SOF_SetCertTrustList(SOF_BSTR CTLAltName, SOF_BSTR CTLContent, SOF_SHORT CTLContentLen)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_SETCERTTRUSTLIST, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_SETCERTTRUSTLIST, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetCertTrustListAltNames(void)
|
SOF_BSTR SOF_GetCertTrustListAltNames(void)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETCERTTRUSTLISTALTNAMES, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETCERTTRUSTLISTALTNAMES, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetCertTrustList(BSTR CTLAltName)
|
SOF_BSTR SOF_GetCertTrustList(SOF_BSTR CTLAltName)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETCERTTRUSTLIST, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETCERTTRUSTLIST, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_DelCertTrustList(BSTR CTLAltName)
|
SOF_LONG SOF_DelCertTrustList(SOF_BSTR CTLAltName)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_DELCERTTRUSTLIST, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_DELCERTTRUSTLIST, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_InitCertAppPolicy(BSTR PolicyName)
|
SOF_LONG SOF_InitCertAppPolicy(SOF_BSTR PolicyName)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_INITCERTAPPPOLICY, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_INITCERTAPPPOLICY, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetServerCertificate(short CertUsage)
|
SOF_BSTR SOF_GetServerCertificate(SOF_SHORT CertUsage)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETSERVERCERTIFICATE, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETSERVERCERTIFICATE, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_SignMessageDetach(BSTR InData)
|
SOF_BSTR SOF_SignMessageDetach(SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_SIGNMESSAGEDETACH, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_SIGNMESSAGEDETACH, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_VerifySignedMessageDetach(BSTR InData, BSTR SignedMessage)
|
SOF_LONG SOF_VerifySignedMessageDetach(SOF_BSTR InData, SOF_BSTR SignedMessage)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_VERIFYSIGNEDMESSAGEDETACH, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_VERIFYSIGNEDMESSAGEDETACH, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_CreateTimeStampRequest(BSTR InData)
|
SOF_BSTR SOF_CreateTimeStampRequest(SOF_BSTR InData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_CREATETIMESTAMPREQUEST, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_CREATETIMESTAMPREQUEST, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_CreateTimeStampResponse(BSTR TimeStampRequest)
|
SOF_BSTR SOF_CreateTimeStampResponse(SOF_BSTR TimeStampRequest)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_CREATETIMESTAMPRESPONSE, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_CREATETIMESTAMPRESPONSE, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SOF_VerifyTimeStamp(BSTR InData, BSTR tsResponseData)
|
SOF_LONG SOF_VerifyTimeStamp(SOF_BSTR InData, SOF_BSTR tsResponseData)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_VERIFYTIMESTAMP, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_VERIFYTIMESTAMP, SOF_R_NOT_IMPLEMENTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR SOF_GetTimeStampInfo(BSTR tsResponseData, short type)
|
SOF_BSTR SOF_GetTimeStampInfo(SOF_BSTR tsResponseData, SOF_SHORT type)
|
||||||
{
|
{
|
||||||
SOFerr(SOF_F_SOF_GETTIMESTAMPINFO, SOF_R_NOT_IMPLEMENTED);
|
SOFerr(SOF_F_SOF_GETTIMESTAMPINFO, SOF_R_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -419,10 +419,6 @@ typedef HANDLE HCONTAINER;
|
|||||||
#define SGD_MAX_COUNT 64
|
#define SGD_MAX_COUNT 64
|
||||||
#define SGD_MAX_NAME_SIZE 256
|
#define SGD_MAX_NAME_SIZE 256
|
||||||
|
|
||||||
/* SOF */
|
|
||||||
|
|
||||||
typedef char *BSTR;
|
|
||||||
typedef long BOOL;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -55,54 +55,60 @@
|
|||||||
|
|
||||||
#include <openssl/sgd.h>
|
#include <openssl/sgd.h>
|
||||||
|
|
||||||
|
typedef char * SOF_BSTR;
|
||||||
|
typedef long SOF_LONG;
|
||||||
|
typedef short SOF_SHORT;
|
||||||
|
typedef SOF_LONG SOF_BOOL;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BSTR SOF_GetVersion(void);
|
|
||||||
long SOF_SetSignMethod(long SignMethod);
|
|
||||||
long SOF_GetSignMethod(void);
|
|
||||||
long SOF_SetEncryptMethod(long EncryptMethod);
|
|
||||||
long SOF_GetEncryptMethod(void);
|
|
||||||
BSTR SOF_GetUserList(void);
|
|
||||||
BSTR SOF_ExportUserCert(BSTR ContainerName);
|
|
||||||
BOOL SOF_Login(BSTR ContainerName, BSTR PassWd);
|
|
||||||
long SOF_GetPinRetryCount(BSTR ContainerName);
|
|
||||||
BOOL SOF_ChangePassWd(BSTR ContainerName, BSTR OldPassWd, BSTR NewPassWd);
|
|
||||||
BSTR SOF_ExportExchangeUserCert(BSTR ContainerName);
|
|
||||||
BSTR SOF_GetCertInfo(BSTR Base64EncodeCert, short Type);
|
|
||||||
BSTR SOF_GetCertInfoByOid(BSTR Base64EncodeCert, BSTR Oid);
|
|
||||||
BSTR SOF_GetDeviceInfo(BSTR ContainerName, long Type);
|
|
||||||
long SOF_ValidateCert(BSTR Base64EncodeCert);
|
|
||||||
BSTR SOF_SignData(BSTR ContainerName, BSTR InData);
|
|
||||||
BOOL SOF_VerifySignedData(BSTR Base64EncodeCert, BSTR InData, BSTR SignValue);
|
|
||||||
BSTR SOF_SignFile(BSTR ContainerName, BSTR InFile);
|
|
||||||
BOOL SOF_VerifySignedFile(BSTR Base64EncodeCert, BSTR InFile, BSTR SignValue);
|
|
||||||
BSTR SOF_EncryptData(BSTR Base64EncodeCert, BSTR InData);
|
|
||||||
BSTR SOF_DecryptData(BSTR ContainerName, BSTR InData);
|
|
||||||
BOOL SOF_EncryptFile(BSTR Base64EncodeCert, BSTR InFile, BSTR OutFile);
|
|
||||||
BOOL SOF_DecryptFile(BSTR ContainerName, BSTR InFile, BSTR OutFile);
|
|
||||||
BSTR SOF_SignMessage(short flag, BSTR ContainerName, BSTR InData);
|
|
||||||
BOOL SOF_VerifySignedMessage(BSTR MessageData, BSTR InData);
|
|
||||||
BSTR SOF_GetInfoFromSignedMessage(BSTR SignedMessage, short Type);
|
|
||||||
BSTR SOF_SignDataXML(BSTR ContainerName, BSTR InData);
|
|
||||||
BOOL SOF_VerifySignedDataXML(BSTR InData);
|
|
||||||
BSTR SOF_GetXMLSignatureInfo(BSTR XMLSignedData, short Type);
|
|
||||||
BSTR SOF_GenRandom(short RandomLen);
|
|
||||||
long SOF_GetLastError(void);
|
|
||||||
|
|
||||||
long SOF_SetCertTrustList(BSTR CTLAltName, BSTR CTLContent, short CTLContentLen);
|
SOF_BSTR SOF_GetVersion(void);
|
||||||
BSTR SOF_GetCertTrustListAltNames(void);
|
SOF_LONG SOF_SetSignMethod(SOF_LONG SignMethod);
|
||||||
BSTR SOF_GetCertTrustList(BSTR CTLAltName);
|
SOF_LONG SOF_GetSignMethod(void);
|
||||||
long SOF_DelCertTrustList(BSTR CTLAltName);
|
SOF_LONG SOF_SetEncryptMethod(SOF_LONG EncryptMethod);
|
||||||
long SOF_InitCertAppPolicy(BSTR PolicyName);
|
SOF_LONG SOF_GetEncryptMethod(void);
|
||||||
BSTR SOF_GetServerCertificate(short CertUsage);
|
SOF_BSTR SOF_GetUserList(void);
|
||||||
BSTR SOF_SignMessageDetach(BSTR InData);
|
SOF_BSTR SOF_ExportUserCert(SOF_BSTR ContainerName);
|
||||||
long SOF_VerifySignedMessageDetach(BSTR InData, BSTR SignedMessage);
|
SOF_BOOL SOF_Login(SOF_BSTR ContainerName, SOF_BSTR PassWd);
|
||||||
BSTR SOF_CreateTimeStampRequest(BSTR InData);
|
SOF_LONG SOF_GetPinRetryCount(SOF_BSTR ContainerName);
|
||||||
BSTR SOF_CreateTimeStampResponse(BSTR TimeStampRequest);
|
SOF_BOOL SOF_ChangePassWd(SOF_BSTR ContainerName, SOF_BSTR OldPassWd, SOF_BSTR NewPassWd);
|
||||||
long SOF_VerifyTimeStamp(BSTR InData, BSTR tsResponseData);
|
SOF_BSTR SOF_ExportExchangeUserCert(SOF_BSTR ContainerName);
|
||||||
BSTR SOF_GetTimeStampInfo(BSTR tsResponseData, short type);
|
SOF_BSTR SOF_GetCertInfo(SOF_BSTR Base64EncodeCert, SOF_SHORT Type);
|
||||||
|
SOF_BSTR SOF_GetCertInfoByOid(SOF_BSTR Base64EncodeCert, SOF_BSTR Oid);
|
||||||
|
SOF_BSTR SOF_GetDeviceInfo(SOF_BSTR ContainerName, SOF_LONG Type);
|
||||||
|
SOF_LONG SOF_ValidateCert(SOF_BSTR Base64EncodeCert);
|
||||||
|
SOF_BSTR SOF_SignData(SOF_BSTR ContainerName, SOF_BSTR InData);
|
||||||
|
SOF_BOOL SOF_VerifySignedData(SOF_BSTR Base64EncodeCert, SOF_BSTR InData, SOF_BSTR SignValue);
|
||||||
|
SOF_BSTR SOF_SignFile(SOF_BSTR ContainerName, SOF_BSTR InFile);
|
||||||
|
SOF_BOOL SOF_VerifySignedFile(SOF_BSTR Base64EncodeCert, SOF_BSTR InFile, SOF_BSTR SignValue);
|
||||||
|
SOF_BSTR SOF_EncryptData(SOF_BSTR Base64EncodeCert, SOF_BSTR InData);
|
||||||
|
SOF_BSTR SOF_DecryptData(SOF_BSTR ContainerName, SOF_BSTR InData);
|
||||||
|
SOF_BOOL SOF_EncryptFile(SOF_BSTR Base64EncodeCert, SOF_BSTR InFile, SOF_BSTR OutFile);
|
||||||
|
SOF_BOOL SOF_DecryptFile(SOF_BSTR ContainerName, SOF_BSTR InFile, SOF_BSTR OutFile);
|
||||||
|
SOF_BSTR SOF_SignMessage(SOF_SHORT flag, SOF_BSTR ContainerName, SOF_BSTR InData);
|
||||||
|
SOF_BOOL SOF_VerifySignedMessage(SOF_BSTR MessageData, SOF_BSTR InData);
|
||||||
|
SOF_BSTR SOF_GetInfoFromSignedMessage(SOF_BSTR SignedMessage, SOF_SHORT Type);
|
||||||
|
SOF_BSTR SOF_SignDataXML(SOF_BSTR ContainerName, SOF_BSTR InData);
|
||||||
|
SOF_BOOL SOF_VerifySignedDataXML(SOF_BSTR InData);
|
||||||
|
SOF_BSTR SOF_GetXMLSignatureInfo(SOF_BSTR XMLSignedData, SOF_SHORT Type);
|
||||||
|
SOF_BSTR SOF_GenRandom(SOF_SHORT RandomLen);
|
||||||
|
SOF_LONG SOF_GetLastError(void);
|
||||||
|
|
||||||
|
SOF_LONG SOF_SetCertTrustList(SOF_BSTR CTLAltName, SOF_BSTR CTLContent, SOF_SHORT CTLContentLen);
|
||||||
|
SOF_BSTR SOF_GetCertTrustListAltNames(void);
|
||||||
|
SOF_BSTR SOF_GetCertTrustList(SOF_BSTR CTLAltName);
|
||||||
|
SOF_LONG SOF_DelCertTrustList(SOF_BSTR CTLAltName);
|
||||||
|
SOF_LONG SOF_InitCertAppPolicy(SOF_BSTR PolicyName);
|
||||||
|
SOF_BSTR SOF_GetServerCertificate(SOF_SHORT CertUsage);
|
||||||
|
SOF_BSTR SOF_SignMessageDetach(SOF_BSTR InData);
|
||||||
|
SOF_LONG SOF_VerifySignedMessageDetach(SOF_BSTR InData, SOF_BSTR SignedMessage);
|
||||||
|
SOF_BSTR SOF_CreateTimeStampRequest(SOF_BSTR InData);
|
||||||
|
SOF_BSTR SOF_CreateTimeStampResponse(SOF_BSTR TimeStampRequest);
|
||||||
|
SOF_LONG SOF_VerifyTimeStamp(SOF_BSTR InData, SOF_BSTR tsResponseData);
|
||||||
|
SOF_BSTR SOF_GetTimeStampInfo(SOF_BSTR tsResponseData, SOF_SHORT type);
|
||||||
|
|
||||||
#define SOR_OK 0x00000000
|
#define SOR_OK 0x00000000
|
||||||
#define SOR_UnknownErr 0x0B000001
|
#define SOR_UnknownErr 0x0B000001
|
||||||
|
|||||||
Reference in New Issue
Block a user