|
S2OPC OPCUA Toolkit
|
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "sopc_crypto_profiles.h"
#include "sopc_crypto_provider.h"
#include "sopc_key_manager.h"
#include "sopc_logger.h"
#include "sopc_macros.h"
#include "sopc_mem_alloc.h"
#include "key_manager_lib.h"
#include "mbedtls/pk.h"
#include "mbedtls/x509.h"
Functions | |
| SOPC_ReturnStatus | SOPC_KeyManager_AsymmetricKey_CreateFromBuffer (const uint8_t *buffer, uint32_t lenBuf, bool is_public, SOPC_AsymmetricKey **ppKey) |
Creates an asymmetric key (usually a private key) from in-memory buffer buffer . More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_AsymmetricKey_CreateFromFile (const char *szPath, SOPC_AsymmetricKey **ppKey, char *password, uint32_t lenPassword) |
| Creates an asymmetric key (usually a private key) from a file in the DER or PEM format. More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_AsymmetricKey_CreateFromCertificate (const SOPC_CertificateList *pCert, SOPC_AsymmetricKey **pKey) |
| Returns the public key of the signed public key. More... | |
| void | SOPC_KeyManager_AsymmetricKey_Free (SOPC_AsymmetricKey *pKey) |
| Frees a previously created asymmetric key created with SOPC_KeyManager_AsymmetricKey_CreateFromBuffer() or SOPC_KeyManager_AsymmetricKey_CreateFromFile(). More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_AsymmetricKey_ToDER (const SOPC_AsymmetricKey *pKey, bool is_public, uint8_t *pDest, uint32_t lenDest, uint32_t *pLenWritten) |
Creates a DER from the AsymmetricKey pKey and copies it to pDest . More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_Certificate_CreateOrAddFromDER (const uint8_t *bufferDER, uint32_t lenDER, SOPC_CertificateList **ppCert) |
| Creates a new Certificate (signed public key) from a DER encoded buffer, or add it to an existing certificate list. More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_Certificate_CreateOrAddFromFile (const char *szPath, SOPC_CertificateList **ppCert) |
| Creates a new Certificate (signed public key) from a file in the DER or PEM format, or add it to an existing certificate list. More... | |
| void | SOPC_KeyManager_Certificate_Free (SOPC_CertificateList *pCert) |
| Frees a Certificate created with SOPC_KeyManager_Certificate_CreateOrAddFromFile() or SOPC_KeyManager_Certificate_CreateOrAddFromDER() More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_Certificate_ToDER (const SOPC_CertificateList *pCert, uint8_t **ppDest, uint32_t *pLenAllocated) |
Encodes a pCert as a DER buffer and writes the result in ppDest . More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_Certificate_GetThumbprint (const SOPC_CryptoProvider *pProvider, const SOPC_CertificateList *pCert, uint8_t *pDest, uint32_t lenDest) |
Computes and writes the thumbprint of pCert to pDest . More... | |
| SOPC_ReturnStatus | KeyManager_Certificate_GetPublicKey (const SOPC_CertificateList *pCert, SOPC_AsymmetricKey *pKey) |
Fills pKey with public key information retrieved from pCert . More... | |
| bool | SOPC_KeyManager_Certificate_CheckApplicationUri (const SOPC_CertificateList *pCert, const char *application_uri) |
| Verify the application URI embedded in a certificate. More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_Certificate_GetMaybeApplicationUri (const SOPC_CertificateList *pCert, char **ppApplicationUri, size_t *pStringLength) |
| Copy the application URI embedded in a certificate. More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_Certificate_GetListLength (const SOPC_CertificateList *pCert, size_t *pLength) |
Return the number of chained certificates in the certificate list pCert . More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_CertificateList_RemoveUnmatchedCRL (SOPC_CertificateList *pCert, const SOPC_CRLList *pCRL, bool *pbMatch) |
Removes (and frees) certificates from pCert that do not have exactly one revocation list in pCRL . More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_CertificateList_FindCertInList (const SOPC_CertificateList *pList, const SOPC_CertificateList *pCert, bool *pbMatch) |
| Finds whether a certificate is in the given certificate list or not. More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_CRL_CreateOrAddFromDER (const uint8_t *bufferDER, uint32_t lenDER, SOPC_CRLList **ppCRL) |
| Creates a new Certificate Revocation List (CRL) from a DER encoded buffer, or add it to an existing CRL list. More... | |
| SOPC_ReturnStatus | SOPC_KeyManager_CRL_CreateOrAddFromFile (const char *szPath, SOPC_CRLList **ppCRL) |
| Creates a new Certificate Revocation List (CRL) from a file in the DER or PEM format, or add it to an existing CRL list. More... | |
| void | SOPC_KeyManager_CRL_Free (SOPC_CRLList *pCRL) |
| Frees a Certificate created with SOPC_KeyManager_CRL_CreateOrAddFromFile() or SOPC_KeyManager_CRL_CreateOrAddFromDER() More... | |
| SOPC_ReturnStatus KeyManager_Certificate_GetPublicKey | ( | const SOPC_CertificateList * | pCert, |
| SOPC_AsymmetricKey * | pKey | ||
| ) |
Fills pKey
with public key information retrieved from pCert
.
Returns the internal public key of the given signed public key.
pKey
is not valid anymore when pCert
is freed. | SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_CreateFromBuffer | ( | const uint8_t * | buffer, |
| uint32_t | lenBuf, | ||
| bool | is_public, | ||
| SOPC_AsymmetricKey ** | ppKey | ||
| ) |
Creates an asymmetric key (usually a private key) from in-memory buffer buffer
.
Creates an asymmetric key from a buffer
, in DER or PEM format.
| SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_CreateFromCertificate | ( | const SOPC_CertificateList * | pCert, |
| SOPC_AsymmetricKey ** | pKey | ||
| ) |
Returns the public key of the signed public key.
| pCert | A valid pointer to the signed public key. |
| pKey | A handle to the created key structure, the SOPC_AsymmetricKey will then be rewritten to contain the public key. This is not a deep copy, and the key is not valid anymore when the certificate is not valid. This object must be freed with a call to SOPC_KeyManager_AsymmetricKey_Free() which will only deallocate the structure. |
| SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_CreateFromFile | ( | const char * | szPath, |
| SOPC_AsymmetricKey ** | ppKey, | ||
| char * | password, | ||
| uint32_t | lenPassword | ||
| ) |
Creates an asymmetric key (usually a private key) from a file in the DER or PEM format.
Helper function: calls KeyManager_AsymmetricKey_CreateFromBuffer() on the content of the file szPath
.
| void SOPC_KeyManager_AsymmetricKey_Free | ( | SOPC_AsymmetricKey * | pKey | ) |
Frees a previously created asymmetric key created with SOPC_KeyManager_AsymmetricKey_CreateFromBuffer() or SOPC_KeyManager_AsymmetricKey_CreateFromFile().
Frees an asymmetric key created with KeyManager_AsymmetricKey_Create*().
| SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_ToDER | ( | const SOPC_AsymmetricKey * | pKey, |
| bool | is_public, | ||
| uint8_t * | pDest, | ||
| uint32_t | lenDest, | ||
| uint32_t * | pLenWritten | ||
| ) |
Creates a DER from the AsymmetricKey pKey
and copies it to pDest
.
Encodes the pKey
as a DER buffer, and writes the result in pDest
.
This function does not allocate the buffer containing the DER. The operation may fail if the allocated buffer is not large enough. The required length cannot be precisely calculated, but a value of 8 times the key length in bytes is recommended.
| bool SOPC_KeyManager_Certificate_CheckApplicationUri | ( | const SOPC_CertificateList * | pCert, |
| const char * | applicationUri | ||
| ) |
Verify the application URI embedded in a certificate.
This function does a strict, case sensitive comparison of the URIs and does not respect the URI comparison rules from RFC3986 (the URI scheme comparison for example is case sensitive).
SOPC_KeyManager_Certificate_GetMaybeApplicationUri
.| pCert | The certificate. |
| applicationUri | The value that should be stored in the URI subject altName of the certificate. This should be a zero-terminated string. |
pCert
must contain a single certificate.TRUE
if the values match, return FALSE
else. | SOPC_ReturnStatus SOPC_KeyManager_Certificate_CreateOrAddFromDER | ( | const uint8_t * | bufferDER, |
| uint32_t | lenDER, | ||
| SOPC_CertificateList ** | ppCert | ||
| ) |
Creates a new Certificate (signed public key) from a DER encoded buffer, or add it to an existing certificate list.
bufferDER
is lenDER
long, and describes the certificate in the DER format.
| bufferDER | A valid pointer to the buffer containing the DER description. |
| lenDER | The length in bytes of the DER description of the certificate. |
| ppCert | Creation: a valid handle which will point to the newly created Certificate. Addition: a pointer to a pointer to a Certificate list to which add the certificate. In either cases, this object must be freed with a call to SOPC_KeyManager_Certificate_Free(). |
ppCert
set to NULL to avoid double frees.| SOPC_ReturnStatus SOPC_KeyManager_Certificate_CreateOrAddFromFile | ( | const char * | szPath, |
| SOPC_CertificateList ** | ppCert | ||
| ) |
Creates a new Certificate (signed public key) from a file in the DER or PEM format, or add it to an existing certificate list.
| void SOPC_KeyManager_Certificate_Free | ( | SOPC_CertificateList * | pCert | ) |
Frees a Certificate created with SOPC_KeyManager_Certificate_CreateOrAddFromFile() or SOPC_KeyManager_Certificate_CreateOrAddFromDER()
| pCert | The Certificate to free. |
| SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetListLength | ( | const SOPC_CertificateList * | pCert, |
| size_t * | pLength | ||
| ) |
Return the number of chained certificates in the certificate list pCert
.
| pCert | The certificate or certificate list. |
| pLength | A valid pointer to the computed length of the list. |
| SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetMaybeApplicationUri | ( | const SOPC_CertificateList * | pCert, |
| char ** | ppApplicationUri, | ||
| size_t * | pStringLength | ||
| ) |
Copy the application URI embedded in a certificate.
| pCert | The certificate. |
| ppApplicationUri | A pointer to the newly allocated zero-terminated string containing the application URI. |
| pStringLength | Optional pointer to the string length (excluding the trailing \0). |
pCert
must contain a single certificate.| SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetThumbprint | ( | const SOPC_CryptoProvider * | pProvider, |
| const SOPC_CertificateList * | pCert, | ||
| uint8_t * | pDest, | ||
| uint32_t | lenDest | ||
| ) |
Computes and writes the thumbprint of pCert
to pDest
.
The computation of the thumbprint and its size depends on the current security policy. The thumbprint is usually a SHA digest of the DER representation of the certificate.
The size of the thumbprint is provided by SOPC_CryptoProvider_CertificateGetLength_Thumbprint().
| pProvider | An initialized cryptographic context. |
| pCert | A valid pointer to the signed public key to thumbprint. |
| pDest | A valid pointer to the buffer that will contain the thumbprint. |
| lenDest | The length in bytes of pDest . |
pCert
must contain a single certificate.| SOPC_ReturnStatus SOPC_KeyManager_Certificate_ToDER | ( | const SOPC_CertificateList * | pCert, |
| uint8_t ** | ppDest, | ||
| uint32_t * | pLenAllocated | ||
| ) |
Encodes a pCert
as a DER buffer and writes the result in ppDest
.
| pCert | A valid pointer to the Certificate. There must be only one certificate in the list. |
| ppDest | A valid pointer to the newly created buffer that stores the DER description of the signed public key. The allocated buffer must be freed by the caller. |
| pLenAllocated | A valid pointer to the length allocated by this operation. |
pCert
must contain a single certificate.| SOPC_ReturnStatus SOPC_KeyManager_CertificateList_FindCertInList | ( | const SOPC_CertificateList * | pList, |
| const SOPC_CertificateList * | pCert, | ||
| bool * | pbMatch | ||
| ) |
Finds whether a certificate is in the given certificate list or not.
| pList | An optional pointer to the Certificate list. |
| pCert | An optional pointer to a single Certificate to find in the list. |
| pbMatch | A valid pointer to the result of the find. True indicates that the certificate was found in the list. Otherwise false. |
pCert
must contain a single certificate.pCert
has more than one certificate. | SOPC_ReturnStatus SOPC_KeyManager_CertificateList_RemoveUnmatchedCRL | ( | SOPC_CertificateList * | pCert, |
| const SOPC_CRLList * | pCRL, | ||
| bool * | pbMatch | ||
| ) |
Removes (and frees) certificates from pCert
that do not have exactly one revocation list in pCRL
.
This function does not set match to false if there are CRL that do not match any Certificate. This function skips certificates in /p pCert that are not authorities.
| pCert | A valid pointer to the Certificate list. |
| pCRL | A valid pointer to the CRL list. |
| pbMatch | An optional pointer to the result of the test. True value indicates that each certificate in pCert has exactly one associated CRL in pCRL , and no certificate has been freed. Otherwise false. |
pbMatch
is unspecified when return value is not SOPC_STATUS_OK.| SOPC_ReturnStatus SOPC_KeyManager_CRL_CreateOrAddFromDER | ( | const uint8_t * | bufferDER, |
| uint32_t | lenDER, | ||
| SOPC_CRLList ** | ppCRL | ||
| ) |
Creates a new Certificate Revocation List (CRL) from a DER encoded buffer, or add it to an existing CRL list.
bufferDER
is lenDER
long, and describes one CRL in the DER format.
| bufferDER | A valid pointer to the buffer containing the DER description. |
| lenDER | The length in bytes of the DER description of the certificate. |
| ppCRL | Creation: a valid handle which will point to the newly created CRL. Addition: a pointer to a pointer to a CRL list to which add the CRL. In either cases, this object must be freed with a call to SOPC_KeyManager_CRL_Free(). |
ppCRL
set to NULL to avoid double frees.| SOPC_ReturnStatus SOPC_KeyManager_CRL_CreateOrAddFromFile | ( | const char * | szPath, |
| SOPC_CRLList ** | ppCRL | ||
| ) |
Creates a new Certificate Revocation List (CRL) from a file in the DER or PEM format, or add it to an existing CRL list.
| void SOPC_KeyManager_CRL_Free | ( | SOPC_CRLList * | pCRL | ) |
Frees a Certificate created with SOPC_KeyManager_CRL_CreateOrAddFromFile() or SOPC_KeyManager_CRL_CreateOrAddFromDER()
| pCRL | The CRL to free. |


Getting Started:
Gridout is a 12 column layout that uses CSS grid technology.
Download the CSS stylesheet and add it to your html file, add
the appropriate classes to your markup, and start building beautiful UI.
CSS helpers:
Default classes and styles designed to help you create more eye-catching and friendly UI Layouts.
Open Sans font-family from Google Fonts.
It was optimized for print, web, and mobile interfaces, and has excellent legibility characteristics in its letterforms.
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Paragraph
BoldHeader 1
Header 2
Header 3
Header 4
Header 5
Header 6
Paragraph
BoldElements positioning and styling.
.font-light
.font-regular
.font-heavy
.left
.center
.right
.justify
.container
Column system:
If you have ever used another responsive framework, the column system will seem familiar.
Responsive columns:
Available break points are:
- col-#/col-sm-# Landscape phones, 576px and up.
- col-md-# Medium devices,tablets, 768px and up.
- col-lg-# Large devices, desktops, 992px and up.
- col-xl-# Extra large devices, large desktops, 1200px and up.
Viewport size is "sm" all col-# or col-sm-# columns are being applied. Viewport size is "md" all col-md-# columns are being applied. Viewport size is "lg" all col-lg-# columns are being applied. Viewport size is "xl" all col-xl-# columns are being applied. To see other applications try changing the size of the window.
Custom column position:
This implementation can be a bit confusing if you are not used to CSS grid.


Counter Strike : Global Offansive
Valve
Last update: 7 Hours agoThe series began on Windows in 1999 with the first version of Counter-Strike. It was initially released as a modification for Half-Life and designed by Minh "Gooseman" Le and Jess More...
Gous Blood "On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire...
Gous Blood "On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire...
Gous Blood "On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire...


August 16, 2016
Oculus announced that today you can pre-order Rift online from retailers in Europe and Canada. Shipping and in-store availability will begin September 20, and demo experiences will also be rolling out across Europe and Canada over the next several weeks. By fall, Rift demos will be available in more than 600 retail locations across the US, Canada and Europe.
August 16, 2016
Oculus announced that today you can pre-order Rift online from retailers in Europe and Canada. Shipping and in-store availability will begin September 20, and demo experiences will also be rolling out across Europe and Canada over the next several weeks. By fall, Rift demos will be available in more than 600 retail locations across the US, Canada and Europe.


Coronation Street writer reveals soap could go to SEVEN episodes a week
Ellen Taylor has said she thinks the move is very likely
by Carena CrawfordEllen Taylor, one of the top writers on Coronation Street has revealed she is confident the show will go to SEVEN episodes a week.
The soap added an extra episode in 2017 under the leadership of then-boss Kate Oates, but now it's been suggested yet another weekly visit to Weatherfield is on the cards.
Speaking on the Conversation Street podcast Ellen explained the move to six episodes has already presented "challenges".
Read more: Coronation Street SPOILERS: Ken's rushed to hospital
She said: "There are a lot of challenges in terms of production obviously, you need more cast and you need a bigger set.
"Also, it throws up challenges, for me, in terms of stories, and not always good ones if I'm honest.
"That's because when you have six episodes, particularly with our transmission pattern, it's like you have to ramp up the story very quickly.
"I think it makes the story telling more heightened - you've got to have more big dramatic moments because you've got to keep hooking the viewers in and I'm not sure that's always a good thing.
"I still think Corrie maintains a balance very well but I think because of those six episodes a week, those high octane storylines and hooks to keep the viewers, there have become a more dominant feature of the process."
She then added it wasn't likely to calm down any time soon either!
"Increased volume isn't always a good thing. It's a lot more work for everyone.
"It's great for more Corrie, but is it best in the long run? I don't know.
"We're never going to go back down. Emmerdale are already at seven episodes so you know it's going to happen at some point."
Read more: Coronation Street SPOILERS: Daniel arrested
Ellen was responsible for the devastating scenes that saw Sinead Tinker pass away after her battle with cervical cancer last month.
She also wrote Hayley Cropper's funeral episodes and Sarah Platt's breakdown.
Leave us a comment on our Facebook page @EntertainmentDailyFix and let us know what you think!


kcs is a sample to demonstrate the use of kernel mode perflib API. The driver does not control any hardware; it simple provides counters. The code contains comments to explain what each function does.
To test the Kcs counter provider, use the following procedure.
lodctr.exe /m:kcs.man
sc create kcs
binpath= %windir%\system32\kcs.sys
type= kernel start= demand
net start kcs
perfmon.exe
net stop kcs
unlodctr.exe /m:kcs.man
To get the simple driver (kcs.sys), use the following procedure.
This sample driver should not be used in a production environment.
Kcs is designed for Windows 7 and later versions of Windows.
kcs.h
makefile
sources
kcs.c
kcs.rc
The files that comprise Kcs are included in the Windows DDK in the \src\general\perfcounters\kcs directory.
|
|
©
Microsoft Corporation