암호화 기술 - 플랫폼
이 모듈에는 암호화의 플랫폼 추상화가 포함됩니다.
요약
열거 |
|
---|---|
anonymous enum{
|
enum 이 열거형은 키 사용 플래그를 정의합니다. |
otCryptoKeyAlgorithm{
|
enum 이 열거형은 키 알고리즘을 정의합니다. |
otCryptoKeyStorage{
|
enum 이 열거형은 키 저장소 유형을 정의합니다. |
otCryptoKeyType{
|
enum 이 열거형은 키 유형을 정의합니다. |
Typedef |
|
---|---|
otCryptoContext
|
typedefstruct otCryptoContext
|
otCryptoKey
|
typedefstruct otCryptoKey
|
otCryptoKeyRef
|
typedefuint32_t
이 데이터 유형은 키 참조를 나타냅니다. |
otPlatCryptoEcdsaKeyPair
|
typedefstruct otPlatCryptoEcdsaKeyPair
|
otPlatCryptoEcdsaPublicKey
|
typedefstruct otPlatCryptoEcdsaPublicKey
|
otPlatCryptoEcdsaSignature
|
typedefstruct otPlatCryptoEcdsaSignature
|
otPlatCryptoSha256Hash
|
typedefstruct otPlatCryptoSha256Hash
이 구조는 SHA-256 해시를 나타냅니다. |
변수 |
|
---|---|
OT_TOOL_PACKED_END
|
기능 |
|
---|---|
otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput)
|
지정된 데이터를 암호화합니다.
|
otPlatCryptoAesFree(otCryptoContext *aContext)
|
AES 컨텍스트를 해제합니다.
|
otPlatCryptoAesInit(otCryptoContext *aContext)
|
AES 작업을 초기화합니다.
|
otPlatCryptoAesSetKey(otCryptoContext *aContext, const otCryptoKey *aKey)
|
AES 작업의 키를 설정합니다.
|
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
|
PSA ITS에 저장된 키를 폐기합니다.
|
otPlatCryptoEcdsaGenerateKey(otPlatCryptoEcdsaKeyPair *aKeyPair)
|
새 ECDSA 키 쌍으로 출력 버퍼를 생성하고 채웁니다.
|
otPlatCryptoEcdsaGetPublicKey(const otPlatCryptoEcdsaKeyPair *aKeyPair, otPlatCryptoEcdsaPublicKey *aPublicKey)
|
입력 컨텍스트에서 연결된 공개 키를 가져옵니다.
|
otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, const otPlatCryptoSha256Hash *aHash, otPlatCryptoEcdsaSignature *aSignature)
|
입력 컨텍스트의 비공개 키를 사용하여 해시된 메시지의 ECDSA 서명을 계산합니다.
|
otPlatCryptoEcdsaVerify(const otPlatCryptoEcdsaPublicKey *aPublicKey, const otPlatCryptoSha256Hash *aHash, const otPlatCryptoEcdsaSignature *aSignature)
|
입력 컨텍스트의 키를 사용하여 해시된 메시지의 ECDSA 서명을 확인합니다.
|
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
|
PSA ITS에 저장된 키를 내보냅니다.
|
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
|
bool
전달된 키 참조에 PSA ITS에 연결된 키가 있는지 확인합니다.
|
otPlatCryptoHkdfDeinit(otCryptoContext *aContext)
|
HKDF 컨텍스트를 초기화합니다.
|
otPlatCryptoHkdfExpand(otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength)
|
HKDF 확장 단계를 수행합니다.
|
otPlatCryptoHkdfExtract(otCryptoContext *aContext, const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey)
|
HKDF 추출 단계를 수행합니다.
|
otPlatCryptoHkdfInit(otCryptoContext *aContext)
|
HKDF 컨텍스트를 초기화합니다.
|
otPlatCryptoHmacSha256Deinit(otCryptoContext *aContext)
|
HMAC 작업을 초기화합니다.
|
otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength)
|
HMAC 작업을 완료합니다.
|
otPlatCryptoHmacSha256Init(otCryptoContext *aContext)
|
HMAC 작업을 초기화합니다.
|
otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey *aKey)
|
HMAC 작업을 시작합니다.
|
otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
새 입력으로 HMAC 작업을 업데이트합니다.
|
otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen)
|
PSA ITS로 키를 가져옵니다.
|
otPlatCryptoInit(void)
|
void
암호화 모듈을 초기화합니다.
|
otPlatCryptoPbkdf2GenerateKey(const uint8_t *aPassword, uint16_t aPasswordLen, const uint8_t *aSalt, uint16_t aSaltLen, uint32_t aIterationCounter, uint16_t aKeyLen, uint8_t *aKey)
|
void
CMAC (AES-CMAC-PRF-128)를 사용하여 PKCS#5 PBKDF2를 수행합니다.
|
otPlatCryptoRandomDeinit(void)
|
void
암호화 방식으로 안전한 의사 난수 생성기 (CSPRNG)를 초기화합니다.
|
otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize)
|
암호화 방식으로 안전한 임의의 바이트로 지정된 버퍼를 채웁니다.
|
otPlatCryptoRandomInit(void)
|
void
암호학적으로 안전한 의사 난수 생성기 (CSPRNG)를 초기화합니다.
|
otPlatCryptoSha256Deinit(otCryptoContext *aContext)
|
SHA-256 작업을 초기화 해제합니다.
|
otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize)
|
SHA-256 작업을 완료합니다.
|
otPlatCryptoSha256Init(otCryptoContext *aContext)
|
SHA-256 작업을 초기화합니다.
|
otPlatCryptoSha256Start(otCryptoContext *aContext)
|
SHA-256 작업을 시작합니다.
|
otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
새 입력으로 SHA-256 작업을 업데이트합니다.
|
구조체 |
|
---|---|
otCryptoContext를 참조하세요. |
이 구조는 플랫폼 API의 컨텍스트 객체를 저장합니다. |
otCryptoKey |
이 구조는 암호화 작업에 필요한 키 자료를 나타냅니다. |
otPlatCryptoEcdsaKeyPair |
이 구조는 ECDSA 키 쌍 (공개 및 비공개 키)을 나타냅니다. |
otPlatCryptoEcdsaPublicKey를 참조하세요. |
이 구조체는 ECDSA 공개 키를 나타냅니다. |
otPlatCryptoEcdsaSignature |
이 구조체는 ECDSA 서명을 나타냅니다. |
otPlatCryptoSha256해시 |
이 구조는 SHA-256 해시를 나타냅니다. |
열거형
익명 enum
anonymous enum
이 열거형은 키 사용 플래그를 정의합니다.
속성 | |
---|---|
OT_CRYPTO_KEY_USAGE_DECRYPT
|
키 사용: AES ECB. |
OT_CRYPTO_KEY_USAGE_ENCRYPT
|
키 사용: 암호화 (공급업체 정의) |
OT_CRYPTO_KEY_USAGE_EXPORT
|
키 사용: 키를 내보낼 수 있습니다. |
OT_CRYPTO_KEY_USAGE_NONE
|
키 사용: 키 사용이 비어 있습니다. |
OT_CRYPTO_KEY_USAGE_SIGN_HASH
|
키 사용: HMAC SHA-256. |
otCryptoKey알고리즘
otCryptoKeyAlgorithm
이 열거형은 키 알고리즘을 정의합니다.
속성 | |
---|---|
OT_CRYPTO_KEY_ALG_AES_ECB
|
주요 알고리즘: AES ECB. |
OT_CRYPTO_KEY_ALG_HMAC_SHA_256
|
키 알고리즘: HMAC SHA-256. |
OT_CRYPTO_KEY_ALG_VENDOR
|
주요 알고리즘: 공급업체가 정의했습니다. |
otCryptoKey 저장소
otCryptoKeyStorage
이 열거형은 키 저장소 유형을 정의합니다.
속성 | |
---|---|
OT_CRYPTO_KEY_STORAGE_PERSISTENT
|
키 지속성: 키는 영구적입니다. |
OT_CRYPTO_KEY_STORAGE_VOLATILE
|
키 지속성: 키는 휘발성입니다. |
otCryptoKey 유형
otCryptoKeyType
이 열거형은 키 유형을 정의합니다.
속성 | |
---|---|
OT_CRYPTO_KEY_TYPE_AES
|
키 유형: AES. |
OT_CRYPTO_KEY_TYPE_HMAC
|
키 유형: HMAC |
OT_CRYPTO_KEY_TYPE_RAW
|
키 유형: 원시 데이터. |
Typedef
otCryptoContext
struct otCryptoContext otCryptoContext
otCryptoKey
struct otCryptoKey otCryptoKey
otCryptoKeyRef
uint32_t otCryptoKeyRef
이 데이터 유형은 키 참조를 나타냅니다.
otPlatCryptoEcdsaKeyPair
struct otPlatCryptoEcdsaKeyPair otPlatCryptoEcdsaKeyPair
otPlatCryptoEcdsaPublicKey
struct otPlatCryptoEcdsaPublicKey otPlatCryptoEcdsaPublicKey
otPlatCryptoEcdsaSignature
struct otPlatCryptoEcdsaSignature otPlatCryptoEcdsaSignature
변수
OT_TOOL_PACKED_END
OT_TOOL_PACKED_BEGIN struct otPlatCryptoSha256Hash OT_TOOL_PACKED_END
기능
otPlatCryptoAesEncrypt
otError otPlatCryptoAesEncrypt( otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput )
지정된 데이터를 암호화합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoAesFree
otError otPlatCryptoAesFree( otCryptoContext *aContext )
AES 컨텍스트를 해제합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoAesInit
otError otPlatCryptoAesInit( otCryptoContext *aContext )
AES 작업을 초기화합니다.
세부정보 | |||||||||
---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||
반환 값 |
|
otPlatCryptoAesSetKey
otError otPlatCryptoAesSetKey( otCryptoContext *aContext, const otCryptoKey *aKey )
AES 작업의 키를 설정합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoDestroyKey
otError otPlatCryptoDestroyKey( otCryptoKeyRef aKeyRef )
PSA ITS에 저장된 키를 폐기합니다.
세부정보 | |||||
---|---|---|---|---|---|
매개변수 |
|
||||
반환 값 |
|
otPlatCryptoEcdsaGenerateKey
otError otPlatCryptoEcdsaGenerateKey( otPlatCryptoEcdsaKeyPair *aKeyPair )
새 ECDSA 키 쌍으로 출력 버퍼를 생성하고 채웁니다.
세부정보 | |||||||||
---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||
반환 값 |
|
otPlatCryptoEcdsaGetPublicKey
otError otPlatCryptoEcdsaGetPublicKey( const otPlatCryptoEcdsaKeyPair *aKeyPair, otPlatCryptoEcdsaPublicKey *aPublicKey )
입력 컨텍스트에서 연결된 공개 키를 가져옵니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoEcdsaSign
otError otPlatCryptoEcdsaSign( const otPlatCryptoEcdsaKeyPair *aKeyPair, const otPlatCryptoSha256Hash *aHash, otPlatCryptoEcdsaSignature *aSignature )
입력 컨텍스트의 비공개 키를 사용하여 해시된 메시지의 ECDSA 서명을 계산합니다.
이 방식은 RFC 6979의 확정적인 디지털 서명 생성 절차를 사용합니다.
세부정보 | |||||||||
---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||
반환 값 |
|
otPlatCryptoEcdsaVerify
otError otPlatCryptoEcdsaVerify( const otPlatCryptoEcdsaPublicKey *aPublicKey, const otPlatCryptoSha256Hash *aHash, const otPlatCryptoEcdsaSignature *aSignature )
입력 컨텍스트의 키를 사용하여 해시된 메시지의 ECDSA 서명을 확인합니다.
세부정보 | |||||||||
---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||
반환 값 |
|
otPlatCryptoExportKey
otError otPlatCryptoExportKey( otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen )
PSA ITS에 저장된 키를 내보냅니다.
세부정보 | |||||||||
---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||
반환 값 |
|
otPlatCryptoHasKey
bool otPlatCryptoHasKey( otCryptoKeyRef aKeyRef )
전달된 키 참조에 PSA ITS에 연결된 키가 있는지 확인합니다.
세부정보 | |||||
---|---|---|---|---|---|
매개변수 |
|
||||
반환 값 |
|
otPlatCryptoHkdfDeinit
otError otPlatCryptoHkdfDeinit( otCryptoContext *aContext )
HKDF 컨텍스트를 초기화합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoHkdfExpand
otError otPlatCryptoHkdfExpand( otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength )
HKDF 확장 단계를 수행합니다.
세부정보 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||||
반환 값 |
|
otPlatCryptoHkdfExtract
otError otPlatCryptoHkdfExtract( otCryptoContext *aContext, const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey )
HKDF 추출 단계를 수행합니다.
세부정보 | |||||||||
---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||
반환 값 |
|
otPlatCryptoHkdfInit
otError otPlatCryptoHkdfInit( otCryptoContext *aContext )
HKDF 컨텍스트를 초기화합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoHmacSha256Deinit
otError otPlatCryptoHmacSha256Deinit( otCryptoContext *aContext )
HMAC 작업을 초기화합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoHmacSha256Finish
otError otPlatCryptoHmacSha256Finish( otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength )
HMAC 작업을 완료합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoHmacSha256Init
otError otPlatCryptoHmacSha256Init( otCryptoContext *aContext )
HMAC 작업을 초기화합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoHmacSha256시작
otError otPlatCryptoHmacSha256Start( otCryptoContext *aContext, const otCryptoKey *aKey )
HMAC 작업을 시작합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoHmacSha256업데이트
otError otPlatCryptoHmacSha256Update( otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength )
새 입력으로 HMAC 작업을 업데이트합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoImportKey
otError otPlatCryptoImportKey( otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen )
PSA ITS로 키를 가져옵니다.
참고: aKeyPersistence를 위해 OT_CRYPTO_KEY_STORAGE_PERSISTENT를 전달하면 aKeyRef
가 입력되고 플랫폼은 지정된 aKeyRef를 사용해야 하며 변경하면 안 됩니다(MUST NOT).
aKeyPersistence를 위해 OT_CRYPTO_KEY_STORAGE_VOLATILE이 전달되면 aKeyRef
가 출력됩니다. 초깃값은 중요하지 않으며 플랫폼 API는 이 값을 업데이트하여 새 키 참조를 반환해야 합니다(MUST).
세부정보 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
||||||||||||||
반환 값 |
|
이 API는 OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
가 사용 설정된 경우에만 OT 코어에서 사용됩니다.
otPlatCryptoInit
void otPlatCryptoInit( void )
암호화 모듈을 초기화합니다.
otPlatCryptoPbkdf2GenerateKey
void otPlatCryptoPbkdf2GenerateKey( const uint8_t *aPassword, uint16_t aPasswordLen, const uint8_t *aSalt, uint16_t aSaltLen, uint32_t aIterationCounter, uint16_t aKeyLen, uint8_t *aKey )
CMAC (AES-CMAC-PRF-128)를 사용하여 PKCS#5 PBKDF2를 수행합니다.
세부정보 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
매개변수 |
|
otPlatCryptoRandomDeinit
void otPlatCryptoRandomDeinit( void )
암호화 방식으로 안전한 의사 난수 생성기 (CSPRNG)를 초기화합니다.
otPlatCryptoRandomGet
otError otPlatCryptoRandomGet( uint8_t *aBuffer, uint16_t aSize )
암호화 방식으로 안전한 임의의 바이트로 지정된 버퍼를 채웁니다.
세부정보 | |||||
---|---|---|---|---|---|
매개변수 |
|
||||
반환 값 |
|
otPlatCryptoRandomInit
void otPlatCryptoRandomInit( void )
암호학적으로 안전한 의사 난수 생성기 (CSPRNG)를 초기화합니다.
otPlatCryptoSha256Deinit
otError otPlatCryptoSha256Deinit( otCryptoContext *aContext )
SHA-256 작업을 초기화 해제합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoSha256Finish
otError otPlatCryptoSha256Finish( otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize )
SHA-256 작업을 완료합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoSha256Init
otError otPlatCryptoSha256Init( otCryptoContext *aContext )
SHA-256 작업을 초기화합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoSha256시작
otError otPlatCryptoSha256Start( otCryptoContext *aContext )
SHA-256 작업을 시작합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
otPlatCryptoSha256업데이트
otError otPlatCryptoSha256Update( otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength )
새 입력으로 SHA-256 작업을 업데이트합니다.
세부정보 | |||||||
---|---|---|---|---|---|---|---|
매개변수 |
|
||||||
반환 값 |
|
매크로
OT_CRYPTO_ECDSA_MAX_DER_SIZE
OT_CRYPTO_ECDSA_MAX_DER_SIZE 125
EDCSA 키 쌍을 DER 형식으로 나타내는 최대 버퍼 크기 (바이트)입니다.
OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE입니다.
OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE 64
EDCSA 공개 키를 나타내는 버퍼 크기 (바이트)입니다.
OT_CRYPTO_ECDSA_SIGNATURE_SIZE
OT_CRYPTO_ECDSA_SIGNATURE_SIZE 64
EDCSA 서명을 나타내는 버퍼 크기 (바이트)입니다.
OT_CRYPTO_PBDKF2_MAX_SALT_SIZE입니다.
OT_CRYPTO_PBDKF2_MAX_SALT_SIZE 30
최대 PBKDF2 SALT 길이: 솔트 접두어 (6) + 확장 패널 (8) + 네트워크 이름 (16)
OT_CRYPTO_SHA256_HASH_SIZE
OT_CRYPTO_SHA256_HASH_SIZE 32
SHA256 해시의 길이 (바이트)입니다.
자료
OpenThread API 참조 주제는 GitHub에서 제공되는 소스 코드에서 시작됩니다. 자세한 내용을 알아보거나 문서에 참여하려면 리소스를 참고하세요.