-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
pal_signverify.h
52 lines (42 loc) · 2.11 KB
/
pal_signverify.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "pal_digest.h"
#include "pal_seckey.h"
#include "pal_compiler.h"
#include <Security/Security.h>
enum
{
PAL_SignatureAlgorithm_Unknown = 0,
PAL_SignatureAlgorithm_DSA = 1,
PAL_SignatureAlgorithm_RSA_Pkcs1 = 2,
PAL_SignatureAlgorithm_RSA_Pss = 3,
PAL_SignatureAlgorithm_RSA_Raw = 4,
PAL_SignatureAlgorithm_EC = 5,
};
typedef uint32_t PAL_SignatureAlgorithm;
/*
Generate a DSA, RSA or ECDsa signature.
For DSA and ECDsa the hashAlgorithm parameter is ignored and should be set to PAL_Unknown.
Follows pal_seckey return conventions.
*/
PALEXPORT int32_t AppleCryptoNative_SecKeyCreateSignature(SecKeyRef privateKey,
uint8_t* pbDataHash,
int32_t cbDataHash,
PAL_HashAlgorithm hashAlgorithm,
PAL_SignatureAlgorithm signatureAlgorithm,
CFDataRef* pSignatureOut,
CFErrorRef* pErrorOut);
/*
Verify a DSA, RSA or ECDsa signature.
For DSA and ECDsa the hashAlgorithm parameter is ignored and should be set to PAL_Unknown.
Follows pal_seckey return conventions.
*/
PALEXPORT int32_t AppleCryptoNative_SecKeyVerifySignature(SecKeyRef publicKey,
uint8_t* pbDataHash,
int32_t cbDataHash,
uint8_t* pbSignature,
int32_t cbSignature,
PAL_HashAlgorithm hashAlgorithm,
PAL_SignatureAlgorithm signatureAlgorithm,
CFErrorRef* pErrorOut);