purebasic headers for cryptosyski

Share your advanced PureBasic knowledge/code with the community.
seeker
User
User
Posts: 48
Joined: Fri Nov 01, 2013 2:08 am

purebasic headers for cryptosyski

Post by seeker »

this is a super library for encrytion "http://www.cryptosys.net/pki/" and my header for it. maybe someone can use it.

Code: Select all

  ; GENERAL CONSTANTS ;
  #PKI_DIR_ENCRYPT   = 1
  #PKI_DIR_DECRYPT   = 0
  ; Synonyms for direction ;
  #ENCRYPT = 1
  #DECRYPT = 0
  ; Maximum number of bytes in hash digest byte array ;
  #PKI_MAX_HASH_BYTES = 64
  #PKI_SHA1_BYTES     = 20
  #PKI_SHA224_BYTES   = 28
  #PKI_SHA256_BYTES   = 32
  #PKI_SHA384_BYTES   = 48
  #PKI_SHA512_BYTES   = 64
  #PKI_MD5_BYTES      = 16
  #PKI_MD2_BYTES      = 16
  ; Maximum number of hex characters in hash digest (excl null) ;
  #PKI_MAX_HASH_CHARS = (2*#PKI_MAX_HASH_BYTES)
  #PKI_SHA1_CHARS     = (2*#PKI_SHA1_BYTES)
  #PKI_SHA224_CHARS   = (2*#PKI_SHA224_BYTES)
  #PKI_SHA256_CHARS   = (2*#PKI_SHA256_BYTES)
  #PKI_SHA384_CHARS   = (2*#PKI_SHA384_BYTES)
  #PKI_SHA512_CHARS   = (2*#PKI_SHA512_BYTES)
  #PKI_MD5_CHARS      = (2*#PKI_MD5_BYTES)
  #PKI_MD2_CHARS      = (2*#PKI_MD2_BYTES)
  ; Synonym retained for backwards compatibility ;
  #PKI_MAX_HASH_LEN   = #PKI_MAX_HASH_CHARS
  ; Encryption block sizes in bytes ;
  #PKI_BLK_TDEA_BYTES = 8
  #PKI_BLK_AES_BYTES  = 16
  ; Key size in bytes ;
  #PKI_KEYSIZE_TDEA_BYTES = 24
  #PKI_KEYSIZE_MAX_BYTES  = 32
  ; Required size for RNG seed file ;
  #PKI_RNG_SEED_BYTES = 64

  ; OPTION FLAGS ;
  #PKI_DEFAULT       = 0
  ; Signature algorithms ;
  #PKI_SIG_SHA1RSA   = 0
  #PKI_SIG_MD5RSA    = 1
  #PKI_SIG_MD2RSA    = 2
  #PKI_SIG_SHA256RSA = 3
  #PKI_SIG_SHA384RSA = 4
  #PKI_SIG_SHA512RSA = 5
  #PKI_SIG_SHA224RSA = 6
  
  ; PKCS#5 Password-based encryption algorithms ;
  #PKI_PBE_SHA_3DES  = 0
  #PKI_PBE_MD5_DES   = 1
  #PKI_PBE_MD2_DES   = 2
  #PKI_PBE_SHA_DES   = 3
  #PKI_PBES2_3DES   = 4
  #PKI_PBE_PBES2   = 4096

  ; Message digest hash algorithms ;
  #PKI_HASH_SHA1     = 0
  #PKI_HASH_MD5      = 1
  #PKI_HASH_MD2      = 2
  #PKI_HASH_SHA256   = 3
  #PKI_HASH_SHA384   = 4
  #PKI_HASH_SHA512   = 5
  #PKI_HASH_SHA224   = 6
  #PKI_HASH_MODE_TEXT=  65536

  ; nFermatExp values for RSA exponent ;
  #PKI_RSAEXP_EQ_3     = 0
  #PKI_RSAEXP_EQ_5     = 1
  #PKI_RSAEXP_EQ_17    = 2
  #PKI_RSAEXP_EQ_257   = 3
  #PKI_RSAEXP_EQ_65537 = 4

  ; Return values for RSA_CheckKey ;
  #PKI_VALID_PUBLICKEY  = 1
  #PKI_VALID_PRIVATEKEY = 0

  ; RSA key generation ;
  #PKI_KEYGEN_INDICATE  = 16777216

  #PKI_KEY_FORMAT_PEM   = 65536
  #PKI_KEY_FORMAT_SSL   = 131072

  #PKI_PFX_NO_PRIVKEY   = 16
  #PKI_PFX_PLAIN_CERT   = 33554432 ; New in v3.8 ;
  #PKI_PFX_CLONE_KEY    = 67108864 ; New in v3.8 ;
  #PKI_PFX_ALT_FORMAT   = 1048576  ; New in v3.8 ;

  #PKI_CMS_FORMAT_BASE64     = 65536
  #PKI_CMS_EXCLUDE_CERTS     =  256
  #PKI_CMS_EXCLUDE_DATA      =  512
  #PKI_CMS_INCLUDE_ATTRS     =  2048
  #PKI_CMS_ADD_SIGNTIME       = 4096
  #PKI_CMS_ADD_SMIMECAP       = 8192
  #PKI_CMS_CERTS_ONLY         = 1024
  #PKI_CMS_NO_OUTER       = 33554432
  #PKI_CMS_ALT_ALGID      = 67108864
  #PKI_CMS_BIGFILE        = 134217728

  #PKI_XML_RSAKEYVALUE  =  1
  #PKI_XML_EXCLPRIVATE  =  16
  #PKI_XML_HEXBINARY    =  256
  
  #PKI_EME_DEFAULT       =   0
  #PKI_EME_PKCSV1_5      =   0
  #PKI_EME_OAEP          =   16
  #PKI_EMSIG_DEFAULT     =   32
  #PKI_EMSIG_PKCSV1_5    = 32
  #PKI_EMSIG_DIGESTONLY  = 4096
  #PKI_EMSIG_DIGINFO     = 8192
  #PKI_EMSIG_ISO9796     = 1048576

  ; Option flags ;
  #PKI_X509_FORMAT_PEM          =       65536
  #PKI_X509_FORMAT_BIN          =       131072
  #PKI_X509_REQ_KLUDGE          =      1048576
  #PKI_X509_NO_TIMECHECK        =     2097152
  #PKI_X509_LATIN1              =      4194304
  #PKI_X509_UTF8                 =     8388608
  #PKI_X509_AUTHKEYID            =    16777216
  #PKI_X509_NO_BASIC             =    33554432
  #PKI_X509_CA_TRUE              =    67108864
  #PKI_X509_VERSION1             =   134217728

  ; Flags for Key Usage ;
  #PKI_X509_KEYUSAGE_DIGITALSIGNATURE  = 1
  #PKI_X509_KEYUSAGE_NONREPUDIATION    = 2
  #PKI_X509_KEYUSAGE_KEYENCIPHERMENT   = 4
  #PKI_X509_KEYUSAGE_DATAENCIPHERMENT  = 8
  #PKI_X509_KEYUSAGE_KEYAGREEMENT      = 16
  #PKI_X509_KEYUSAGE_KEYCERTSIGN       = 32
  #PKI_X509_KEYUSAGE_CRLSIGN           = 64
  #PKI_X509_KEYUSAGE_ENCIPHERONLY      = 128
  #PKI_X509_KEYUSAGE_DECIPHERONLY      = 256
  ; Specific return values ;
  #PKI_X509_EXPIRED        = -1
  #PKI_X509_VALID_NOW      =  0
  #PKI_X509_VERIFY_SUCCESS =  0
  #PKI_X509_VERIFY_FAILURE = -1
  #PKI_X509_REVOKED     =    1
  #PKI_X509_INVALID     =    1

  ; Return values for CNV_CheckUTF ;
  #PKI_CHRS_NOT_UTF8   =  0
  #PKI_CHRS_ALL_ASCII  =  1
  #PKI_CHRS_ANSI8      =  2
  #PKI_CHRS_MULTIBYTE  =  3

  #PKI_CNV_UTF8_FROM_LATIN1 = 1
  #PKI_CNV_LATIN1_FROM_UTF8 = 2

  ; Flags and return values for X.509 and CMS query functions ;
  #PKI_QUERY_GETTYPE    = 1048576
  #PKI_QUERY_NUMBER     = 1
  #PKI_QUERY_STRING     = 2
  #PKI_QUERY_DEFINED_   = 1

  ; Options for RNG functions ;
  #PKI_RNG_STRENGTH_112       =  0
  #PKI_RNG_STRENGTH_128       =  1

  ; New options in v3.2... ;
  ; Block cipher (BC) algorithm options ;
  #PKI_BC_TDEA    = 16
  #PKI_BC_3DES    = 16
  #PKI_BC_DESEDE3 = 16
  #PKI_BC_AES128  = 32
  #PKI_BC_AES192  = 48
  #PKI_BC_AES256  = 64

  ; Block cipher mode options ;
  #PKI_MODE_ECB  = 0
  #PKI_MODE_CBC  = 256
  #PKI_MODE_OFB  = 512
  #PKI_MODE_CFB  = 768
  #PKI_MODE_CTR  = 1024

  ; Key transport algorithms ;
  #PKI_KT_RSAES_PKCS   = 0
  #PKI_KT_RSA_KEM      = 8192

  #PKI_IV_PREFIX = 4096
  #PKII_PAD_LEAVE = 8192

  ; Key derivation functions ;
  #KI_KDF_KDF2     = 0
  #PKI_GEN_PLATFORM = 64

Code: Select all

IncludeFile "Cryptosyspki_Const.pb"  
 
  
Import "diCrPKI.lib"
; GENERAL FUNCTIONS ;
     PKI_Version.l(reserved1.l, reserved2.l) As "PKI_Version"
     PKI_LicenceType.l(reserved.l) As "PKI_LicenceType"
     PKI_LastError.l(*szErrMsg.p-unicode, nMsgLen.l) As "PKI_LastError"
     PKI_ErrorCode.l() As "PKI_ErrorCode"
     PKI_ErrorLookup.l(*szErrMsg.p-unicode, nMsgLen.l, nErrCode.l) As "PKI_ErrorLookup"
     PKI_CompileTime.l(*szTimestamp.p-unicode, nLen.l) As "PKI_CompileTime"
     PKI_ModuleName.l(*szTimestamp.p-unicode, nLen.l, reserved.l) As "PKI_ModuleName"
     PKI_PowerUpTests.l(nOptions.l) As "PKI_PowerUpTests"
; RFC3369 CRYPTOGRAPHIC MESSAGE SYNTAX FUNCTIONS ;
     CMS_MakeEnvData.l(*szFileOut.p-unicode, *szFileIn.p-unicode, *szCertList.p-unicode, *sSeed.p-unicode, nSeedLen.l, nOptions.l) As "CMS_MakeEnvData"
     CMS_MakeEnvDataFromString.l(*szFileOut.p-unicode, *szDataIn.p-unicode, *szCertList.p-unicode, *sSeed.p-unicode, nSeedLen.l, nOptions.l) As "CMS_MakeEnvDataFromString"
     CMS_ReadEnvData.l(*szFileOut.p-unicode, *szFileIn.p-unicode, *szX509File.p-unicode, *szRSAPrivateKey.p-unicode, nOptions.l) As "CMS_ReadEnvData"
     CMS_ReadEnvDataToString.l(*szDataOut.p-unicode, nDataOutLen.l, *szFileIn.p-unicode, *szX509File.p-unicode, *szRSAPrivateKey.p-unicode, nOptions.l) As "CMS_ReadEnvDataToString"
     CMS_MakeSigData.l(*szFileOut.p-unicode, *szFileIn.p-unicode, *szCertList.p-unicode, *szRSAPrivateKey.p-unicode, nOptions.l) As "CMS_MakeSigData"
     CMS_MakeSigDataFromString.l(*szFileOut.p-unicode, *szDataIn.p-unicode, *szCertList.p-unicode, *szRSAPrivateKey.p-unicode, nOptions.l) As "CMS_MakeSigDataFromString"
     CMS_MakeSigDataFromSigValue.l(*szFileOut.p-unicode, *pSigValue.p-unicode, nSigLen.l, *pData.p-unicode, nDataLen.l, *szCertList.p-unicode, nOptions.l) As "CMS_MakeSigDataFromSigValue"
     CMS_MakeDetachedSig.l(*szFileOut.p-unicode, *szHexDigest.p-unicode, *szCertList.p-unicode, *szRSAPrivateKey.p-unicode, nOptions.l) As "CMS_MakeDetachedSig"
     CMS_ReadSigData.l(*szFileOut.p-unicode, *szFileIn.p-unicode, nOptions.l) As "CMS_ReadSigData"
     CMS_ReadSigDataToString.l(*szDataOut.p-unicode,  nDataOutLen.l, *szFileIn.p-unicode, nOptions.l) As "CMS_ReadSigDataToString"
     CMS_GetSigDataDigest.l(*szHexDigestOut.p-unicode, nDigestLen.l, *szFileIn.p-unicode, *szX509File.p-unicode, nOptions.l) As "CMS_GetSigDataDigest"
     CMS_VerifySigData.l(*szFileIn.p-unicode, *szX509File.p-unicode, *szHexDigest.p-unicode, nOptions.l) As "CMS_VerifySigData"
     CMS_QuerySigData.l(*szDataOut.p-unicode, nDataOutLen.l, *szFileIn.p-unicode, *szQuery.p-unicode, nOptions.l) As "CMS_QuerySigData"
     CMS_QueryEnvData.l(*szDataOut.p-unicode, nDataOutLen.l, *szFileIn.p-unicode, *szQuery.p-unicode, nOptions.l) As "CMS_QueryEnvData"
; RSA KEY FUNCTIONS ;
     RSA_MakeKeys.l(*szPubKeyFile.p-unicode, *szPVKFile.p-unicode, nBits.l, nExpFermat.l, nTests.l, nCount.l, *szPassword.p-unicode, *lpSeed.p-unicode, nSeedLen.l, nOptions.l) As "RSA_MakeKeys"
     RSA_ReadEncPrivateKey.l(*szOutput.p-unicode, nOutputLen.l, *szPVKFile.p-unicode, *szPassword.p-unicode, nOptions.l) As "RSA_ReadEncPrivateKey"
     RSA_ReadPrivateKeyInfo.l(*szOutput.p-unicode, nOutputLen.l, *szKeyFile.p-unicode, nOptions.l) As "RSA_ReadPrivateKeyInfo"
     RSA_GetPrivateKeyFromPFX.l(*szOutputFile.p-unicode, *szPfxFile.p-unicode, nOptions.l) As "RSA_GetPrivateKeyFromPFX"
     RSA_ReadPublicKey.l(*szOutput.p-unicode, nOutputLen.l, *szKeyFile.p-unicode, nOptions.l) As "RSA_ReadPublicKey"
     RSA_GetPublicKeyFromCert.l(*szOutput.p-unicode, nOutputLen.l, *szCertFile.p-unicode, nOptions.l) As "RSA_GetPublicKeyFromCert"
     RSA_SavePublicKey.l(*szFileOut.p-unicode, *szKeyString.p-unicode, nOptions.l) As "RSA_SavePublicKey"
     RSA_SavePrivateKeyInfo.l(*szFileOut.p-unicode, *szKeyString.p-unicode, nOptions.l) As "RSA_SavePrivateKeyInfo"
     RSA_SaveEncPrivateKey.l(*szFileOut.p-unicode, *szKeyString.p-unicode, nCount.l, *szPassword.p-unicode, nOptions.l) As "RSA_SaveEncPrivateKey"
     RSA_KeyBits.l(*szKeyString.p-unicode) As "RSA_KeyBits"
     RSA_KeyBytes.l(*szKeyString.p-unicode) As "RSA_KeyBytes"
     RSA_ToXMLString.l(*szOutput.p-unicode, nOutputLen.l, *szKeyString.p-unicode, nOptions.l) As "RSA_ToXMLString"
     RSA_FromXMLString.l(*szOutput.p-unicode, nOutputLen.l, *szXmlString.p-unicode, nOptions.l) As "RSA_FromXMLString"
     RSA_CheckKey.l(*szKeyString.p-unicode, nOptions.l) As "RSA_CheckKey"
     RSA_KeyHashCode.l(*szKeyString.p-unicode) As "RSA_KeyHashCode"
     RSA_KeyMatch.l(*szPrivateKey.p-unicode, *szPublicKey.p-unicode) As "RSA_KeyMatch"
     RSA_ReadPrivateKeyFromPFX.l(*szOutput.p-unicode, nOutChars.l, *szPfxFile.p-unicode, *szPassword.p-unicode, nOptions.l) As "RSA_ReadPrivateKeyFromPFX"
     RSA_PublicKeyFromPrivate.l(*szOutput.p-unicode, nOutChars.l, *szKeyString.p-unicode, nOptions.l) As "RSA_PublicKeyFromPrivate"
; 'RAW' RSA ENCRYPTION/DECRYPTION FUNCTIONS ;
     RSA_RawPublic.l(*lpData.p-unicode, nDataLen.l, *szPublicKey64.p-unicode, nOptions.l) As "RSA_RawPublic"
     RSA_RawPrivate.l(*lpData.p-unicode, nDataLen.l, *szPrivateKey64.p-unicode, nOptions.l) As "RSA_RawPrivate"
     RSA_EncodeMsg.l(*lpOutput.p-unicode, nOutputLen.l, *abMessage.p-unicode, nMsgLen.l, nOptions.l) As "RSA_EncodeMsg"
     RSA_DecodeMsg.l(*lpOutput.p-unicode, nOutputLen.l, *abInput.p-unicode, nInputLen.l, nOptions.l) As "RSA_DecodeMsg"
; SIGNATURE FUNCTIONS [new in v3.7] ;
     SIG_Sign.l(*szOutput.p-unicode, nOutChars.l, *lpMessage.p-unicode, nMsgLen.l, *szKeyFileOrString.p-unicode, *szPassword.p-unicode, nOptions.l) As "SIG_Sign"
     SIG_Verify.l(*szSig64.p-unicode, *lpMessage.p-unicode, nMsgLen.l, *szKeyFileOrString.p-unicode, nOptions.l) As "SIG_Verify"
     SIG_ExtractDigest.l(*szOutput.p-unicode, nOutChars.l, *szSig64.p-unicode, *szKeyFileOrString.p-unicode, nOptions.l) ; PKCS12 FILE FUNCTIONS ; As "SIG_ExtractDigest"
     PFX_MakeFile.l(*szFileOut.p-unicode, *szCertFile.p-unicode, *szKeyFile.p-unicode, *szPassword.p-unicode, *szFriendlyName.p-unicode, options.l) As "PFX_MakeFile"
     PFX_VerifySig.l(*szFileName.p-unicode, *szPassword.p-unicode, options.l) As "PFX_VerifySig"
; X509 CERTIFICATE FUNCTIONS ;
     X509_MakeCert.l(*certfile.p-unicode, *issuerCert.p-unicode, *subjectPubkeyFile.p-unicode, *issuerPvkInfoFile.p-unicode, certnum.l, yearsvalid.l, *distName.p-unicode, *extensions.p-unicode, keyUsageFlags.l, *password.p-unicode, optionFlags.l) As "X509_MakeCert"
     X509_MakeCertSelf.l(*certfile.p-unicode, *epkfile.p-unicode, certnum.l, yearsvalid.l, *distName.p-unicode, *extensions.p-unicode, keyUsageFlags.l, *password.p-unicode, optionFlags.l) As "X509_MakeCertSelf"
     X509_CertRequest.l(*reqfile.p-unicode, *epkfile.p-unicode, *distName.p-unicode, *reserved.p-unicode, *password.p-unicode, optionFlags.l) As "X509_CertRequest"
     X509_VerifyCert.l(*szCertToVerify.p-unicode, *szIssuerCert.p-unicode, nOptions.l) As "X509_VerifyCert"
     X509_CertThumb.l(*szCertFile.p-unicode, *szHash.p-unicode, nHashLen.l, nOptions.l) As "X509_CertThumb"
     X509_CertIsValidNow.l(*szCertFile.p-unicode, nOptions.l) As "X509_CertIsValidNow"
     X509_CertIssuedOn.l(*szCertFile.p-unicode, *szOutput.p-unicode, nOutChars.l, nOptions.l) As "X509_CertIssuedOn"
     X509_CertExpiresOn.l(*szCertFile.p-unicode, *szOutput.p-unicode, nOutChars.l, nOptions.l) As "X509_CertExpiresOn"
     X509_CertSerialNumber.l(*szCertFile.p-unicode, *szOutput.p-unicode, nOutChars.l, nOptions.l) As "X509_CertSerialNumber"
     X509_HashIssuerAndSN.l(*szCertFile.p-unicode, *szOutput.p-unicode, nOutChars.l, nOptions.l) As "X509_HashIssuerAndSN"
     X509_CertIssuerName.l(*szCertFile.p-unicode, *szOutput.p-unicode, nOutChars.l, *szDelim.p-unicode, nOptions.l) As "X509_CertIssuerName"
     X509_CertSubjectName.l(*szCertFile.p-unicode, *szOutput.p-unicode, nOutChars.l, *szDelim.p-unicode, nOptions.l) As "X509_CertSubjectName"
     X509_GetCertFromP7Chain.l(*szOutput.p-unicode, *szP7cFile.p-unicode, nIndex.l, nOptions.l) As "X509_GetCertFromP7Chain"
     X509_GetCertFromPFX.l(*szOutput.p-unicode, *szPfxFile.p-unicode, *szReserved.p-unicode, nOptions.l) As "X509_GetCertFromPFX"
     X509_KeyUsageFlags.l(*szCertFile.p-unicode) As "X509_KeyUsageFlags"
     X509_QueryCert.l(*szOutput.p-unicode, nOutChars.l, *szCertFile.p-unicode, *szQuery.p-unicode, nOptions.l) As "X509_QueryCert"
     X509_ReadStringFromFile.l(*szOutput.p-unicode, nOutChars.l, *szCertFile.p-unicode, nOptions.l) As "X509_ReadStringFromFile"
     X509_SaveFileFromString.l(*szOutput.p-unicode, *szCertString.p-unicode, nOptions.l) As "X509_SaveFileFromString"
     X509_TextDump.l(*szFileOut.p-unicode, *szCertFile.p-unicode, nOptions.l) As "X509_TextDump"
     X509_ValidatePath.l(*szCertListOrP7File.p-unicode, *szTrustedCert.p-unicode, nOptions.l) As "X509_ValidatePath"
; X509 CRL FUNCTIONS [new in v3.5] ;
     X509_MakeCRL.l(*szCrlFile.p-unicode, *szIssuerCert.p-unicode, *szIssuerKeyFile.p-unicode, *szPassword.p-unicode, *szRevokedCertList.p-unicode, *szExtensions.p-unicode, nOptions.l) As "X509_MakeCRL"
     X509_CheckCertInCRL.l(*szCertFile.p-unicode, *szCrlFile.p-unicode, *szCRLIssuerCert.p-unicode, *szDate.p-unicode, nOptions.l) As "X509_CheckCertInCRL"
; ONLINE CERTIFICATE STATUS PROTOCOL .l(OCSP) FUNCTIONS [new in v3.5] ;
     OCSP_MakeRequest.l(*szOutput.p-unicode, nOutChars.l, *szIssuerCert.p-unicode, *szCertFileOrSerialNum.p-unicode, *szExtensions.p-unicode, nOptions.l) As "OCSP_MakeRequest"
     OCSP_ReadResponse.l(*szOutput.p-unicode, nOutChars.l, *szResponseFile.p-unicode, *szIssuerCert.p-unicode, *szExtensions.p-unicode, nOptions.l) As "OCSP_ReadResponse"
; TRIPLE DES FUNCTIONS ;
     TDEA_HexMode.l(*szOutput.p-unicode, *szInput.p-unicode, *szKey.p-unicode, fEncrypt.l, *szMode.p-unicode, *szIV.p-unicode) As "TDEA_HexMode"
     TDEA_B64Mode.l(*szOutput.p-unicode, *szInput.p-unicode, *szKey.p-unicode, fEncrypt.l, *szMode.p-unicode, *szIV.p-unicode) As "TDEA_B64Mode"
     TDEA_BytesMode.l(*lpOutput.p-unicode, *lpInput.p-unicode, nBytes.l, *lpKey.p-unicode, fEncrypt.l, *szMode.p-unicode, *lpIV.p-unicode) As "TDEA_BytesMode"
     TDEA_File.l(*szFileOut.p-unicode, *szFileIn.p-unicode, *lpKey.p-unicode, fEncrypt.l, *szMode.p-unicode, *lpIV.p-unicode) As "TDEA_File"
; GENERIC BLOCK CIPHER FUNCTIONS ;
     CIPHER_Bytes.l(fEncrypt.l, *lpOutput.p-unicode, *lpData.p-unicode, nDataLen.l, *lpKey.p-unicode, *lpIV.p-unicode, *szAlgAndMode.p-unicode, nOptions.l) As "CIPHER_Bytes"
     CIPHER_File.l(fEncrypt.l, *szFileOut.p-unicode, *szFileIn.p-unicode, *lpKey.p-unicode, *lpIV.p-unicode, *szAlgAndMode.p-unicode, nOptions.l) As "CIPHER_File"
     CIPHER_Hex.l(fEncrypt.l, *szOutput.p-unicode, nOutChars.l, *szData.p-unicode, *szKey.p-unicode, *szIV.p-unicode, *szAlgAndMode.p-unicode, nOptions.l) As "CIPHER_Hex"
     CIPHER_KeyWrap.l(*lpOutput.p-unicode, nOutBytes.l, *lpData.p-unicode, nDataLen.l, *lpKEK.p-unicode, nKekLen.l, nOptions.l) As "CIPHER_KeyWrap"
     CIPHER_KeyUnwrap.l(*lpOutput.p-unicode, nOutBytes.l, *lpData.p-unicode, nDataLen.l, *lpKEK.p-unicode, nKekLen.l, nOptions.l) As "CIPHER_KeyUnwrap"
; MESSAGE DIGEST HASH FUNCTIONS ;
     HASH_Bytes.l(*lpDigest.p-unicode, nDigLen.l, *lpMessage.p-unicode, nMsgLen.l, nOptions.l) As "HASH_Bytes"
     HASH_File.l(*lpDigest.p-unicode, nDigLen.l, *szFileName.p-unicode, nOptions.l) As "HASH_File"
     HASH_HexFromBytes.l(*szOutput.p-unicode, nOutChars.l, *lpMessage.p-unicode, nMsgLen.l, nOptions.l) As "HASH_HexFromBytes"
     HASH_HexFromFile.l(*szOutput.p-unicode, nOutChars.l, *szFileName.p-unicode, nOptions.l) As "HASH_HexFromFile"
     HASH_HexFromHex.l(*szOutput.p-unicode, nOutChars.l, *szMsgHex.p-unicode, nOptions.l) As "HASH_HexFromHex"
; HMAC FUNCTIONS ;
     HMAC_Bytes.l(*lpDigest.p-unicode, nDigLen.l, *lpMessage.p-unicode, nMsgLen.l, *lpKey.p-unicode, nKeyLen.l, nOptions.l) As "HMAC_Bytes"
     HMAC_HexFromBytes.l(*szOutput.p-unicode, nOutChars.l, *lpMessage.p-unicode, nMsgLen.l, *lpKey.p-unicode, nKeyLen.l, nOptions.l) As "HMAC_HexFromBytes"
     HMAC_HexFromHex.l(*szOutput.p-unicode, nOutChars.l, *szMsgHex.p-unicode, *szKeyHex.p-unicode, nOptions.l) As "HMAC_HexFromHex"
; BASE64 AND HEX CONVERSION FUNCTIONS ;
     CNV_B64StrFromBytes.l(*szOutput.p-unicode, nOutChars.l, *input.p-unicode, nbytes.l) As "CNV_B64StrFromBytes"
     CNV_BytesFromB64Str.l(*output.p-unicode, out_len.l, *input.p-unicode) As "CNV_BytesFromB64Str"
     CNV_B64Filter.l(*szOutput.p-unicode, *input.p-unicode, len.l) As "CNV_B64Filter"
     CNV_HexStrFromBytes.l(*szOutput.p-unicode, nOutChars.l, *input.p-unicode, nbytes.l) As "CNV_HexStrFromBytes"
     CNV_BytesFromHexStr.l(*output.p-unicode, out_len.l, *input.p-unicode) As "CNV_BytesFromHexStr"
     CNV_HexFilter.l(*szOutput.p-unicode, *input.p-unicode, len.l) As "CNV_HexFilter"
; UTF-8 CONVERSION/CHECK FUNCTIONS ;
     CNV_UTF8FromLatin1.l(*szOutput.p-unicode, nOutChars.l, *szInput.p-unicode) As "CNV_UTF8FromLatin1"
     CNV_Latin1FromUTF8.l(*szOutput.p-unicode, nOutChars.l, *szInput.p-unicode) As "CNV_Latin1FromUTF8"
     CNV_CheckUTF8.l(*szInput.p-unicode) As "CNV_CheckUTF8"
     CNV_UTF8BytesFromLatin1.l(*lpOutput.p-unicode, nOutBytes.l, *szInput.p-unicode) As "CNV_UTF8BytesFromLatin1"
     CNV_Latin1FromUTF8Bytes.l(*szOutput.p-unicode, nOutChars.l, *lpInput.p-unicode, nBytes.l) As "CNV_Latin1FromUTF8Bytes"
     CNV_CheckUTF8Bytes.l(*lpInput.p-unicode, nBytes.l) As "CNV_CheckUTF8Bytes"
     CNV_CheckUTF8File.l(*szFileName.p-unicode) As "CNV_CheckUTF8File"
     CNV_ByteEncoding.l(*lpOutput.p-unicode, nOutBytes.l, *lpInput.p-unicode, nBytes.l, nOptions.l) As "CNV_ByteEncoding"
; PEM/BINARY FILE CONVERSIONS ;
     PEM_FileFromBinFile.l(*szOutputFile.p-unicode, *szFileIn.p-unicode, *szHeader.p-unicode, nLineLen.l) As "PEM_FileFromBinFile"
     PEM_FileToBinFile.l(*szOutputFile.p-unicode, *szFileIn.p-unicode) As "PEM_FileToBinFile"
; RNG FUNCTIONS ;
     RNG_Bytes.l(*lpOutput.p-unicode, nOutputLen.l, *lpSeed.p-unicode, nSeedLen.l) As "RNG_Bytes"
     RNG_Number.l(nLower.l, nUpper.l) As "RNG_Number"
     RNG_BytesWithPrompt.l(*lpOutput.p-unicode, nOutputLen.l, *szPrompt.p-unicode, nOptions.l) As "RNG_BytesWithPrompt"
     RNG_Initialize.l(*szSeedFile.p-unicode, nOptions.l) As "RNG_Initialize"
     RNG_MakeSeedFile.l(*szSeedFile.p-unicode, *szPrompt.p-unicode, nOptions.l) As "RNG_MakeSeedFile"
     RNG_UpdateSeedFile.l(*szSeedFile.p-unicode, nOptions.l) As "RNG_UpdateSeedFile"
     RNG_Test.l(*szFileName.p-unicode, nOptions.l) As "RNG_Test"
; PADDING FUNCTIONS [new in v3.6] ;
     PAD_BytesBlock.l(*lpOutput.p-unicode, nOutputLen.l, *lpInput.p-unicode, nBytes.l, nBlkLen.l, nOptions.l) As "PAD_BytesBlock"
     PAD_UnpadBytes.l(*lpOutput.p-unicode, nOutputLen.l, *lpInput.p-unicode, nBytes.l, nBlkLen.l, nOptions.l) As "PAD_UnpadBytes"
     PAD_HexBlock.l(*szOutput.p-unicode, nMaxChars.l, *szInput.p-unicode, nBlkLen.l, nOptions.l) As "PAD_HexBlock"
     PAD_UnpadHex.l(*szOutput.p-unicode, nMaxChars.l, *szInput.p-unicode, nBlkLen.l, nOptions.l) As "PAD_UnpadHex"
; MISC UTILITIES ;
     WIPE_File.l(*szFileName.p-unicode, nOptions.l) As "WIPE_File"
     WIPE_Data.l(*lpData.p-unicode, nDataLen.l) As "WIPE_Data"
     PWD_Prompt.l(*szPassword.p-unicode, nPwdLen.l, *szCaption.p-unicode) As "PWD_Prompt"
     PWD_PromptEx.l(*szPassword.p-unicode, nPwdLen.l, *szCaption.p-unicode, *szPrompt.p-unicode, nOptions.l) As "PWD_PromptEx"
EndImport
rudz
User
User
Posts: 35
Joined: Sun Mar 21, 2010 6:59 am
Location: Denmark
Contact:

Re: purebasic headers for cryptosyski

Post by rudz »

Thanks, could become useful :)
AMD FX-8350 @ ~4.8GHz | 8GB Corsair DDR3-SDRAM @ 1800Mhz | 7even Ult & Manjaro 0.8.7.1 | PB 5.3
Web: rudz.dk
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: purebasic headers for cryptosyski

Post by SeregaZ »

i have some certificate .p12. and i have a code for registration this certificate with PFXImportCertStore command. so problem is - this is a little another type of certificate and PFXImportCertStore dont work with it. can i use this library to check my certificate? and how to do this? i need download that lib from that cite, than add this code to new project and then? how to set my pathfile and password?

i think it must be look like this one: https://social.msdn.microsoft.com/Forum ... wssecurity

X509Certificate2 certFile = new X509Certificate2("file.pfx", "certpassword");

but how it used? https://msdn.microsoft.com/en-us/librar ... s.80).aspx
Post Reply