src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EcDsa.ImportExport.cs (21)
33Interop.Crypto.ErrClearError();
71SafeEcKeyHandle key = Interop.Crypto.EcKeyCreateByExplicitParameters(
87Exception e = Interop.Crypto.CreateOpenSslCryptographicException();
94Interop.Crypto.ErrClearError();
137throw Interop.Crypto.CreateOpenSslCryptographicException();
155X = Crypto.ExtractBignum(qx_bn, cbKey),
156Y = Crypto.ExtractBignum(qy_bn, cbKey)
158parameters.D = d_cb == 0 ? null : Crypto.ExtractBignum(d_bn, cbKey);
234throw Interop.Crypto.CreateOpenSslCryptographicException();
262X = Crypto.ExtractBignum(qx_bn, cbFieldLength),
263Y = Crypto.ExtractBignum(qy_bn, cbFieldLength)
265parameters.D = d_cb == 0 ? null : Crypto.ExtractBignum(d_h, cbSubgroupOrder);
269curve.A = Crypto.ExtractBignum(a_bn, cbFieldLength)!;
270curve.B = Crypto.ExtractBignum(b_bn, cbFieldLength)!;
273X = Crypto.ExtractBignum(gx_bn, cbFieldLength),
274Y = Crypto.ExtractBignum(gy_bn, cbFieldLength)
276curve.Order = Crypto.ExtractBignum(order_bn, cbSubgroupOrder)!;
280curve.Polynomial = Crypto.ExtractBignum(p_bn, pFieldLength)!;
284curve.Prime = Crypto.ExtractBignum(p_bn, pFieldLength)!;
288curve.Cofactor = cofactor_cb == 0 ? null : Crypto.ExtractBignum(cofactor_bn, cofactor_cb);
289curve.Seed = seed_cb == 0 ? null : Crypto.ExtractBignum(seed_bn, seed_cb);
System\Security\Cryptography\AesCcm.OpenSsl.cs (29)
40using (SafeEvpCipherCtxHandle ctx = Interop.Crypto.EvpCipherCreatePartial(GetCipher(key.Length * 8)))
42Interop.Crypto.CheckValidOpenSslHandle(ctx);
46Interop.Crypto.EvpCipherSetKeyAndIV(ctx, ReadOnlySpan<byte>.Empty, ReadOnlySpan<byte>.Empty, Interop.Crypto.EvpCipherDirection.Encrypt);
47Interop.Crypto.EvpCipherSetCcmTagLength(ctx, tag.Length);
48Interop.Crypto.EvpCipherSetCcmNonceLength(ctx, nonce.Length);
49Interop.Crypto.EvpCipherSetKeyAndIV(ctx, key, nonce, Interop.Crypto.EvpCipherDirection.NoChange);
54Interop.Crypto.EvpCipherSetInputLength(ctx, plaintext.Length);
56if (!Interop.Crypto.EvpCipherUpdate(ctx, Span<byte>.Empty, out _, associatedData))
58throw Interop.Crypto.CreateOpenSslCryptographicException();
62if (!Interop.Crypto.EvpCipherUpdate(ctx, ciphertext, out int ciphertextBytesWritten, plaintext))
64throw Interop.Crypto.CreateOpenSslCryptographicException();
67if (!Interop.Crypto.EvpCipherFinalEx(
72throw Interop.Crypto.CreateOpenSslCryptographicException();
83Interop.Crypto.EvpCipherGetCcmTag(ctx, tag);
109using (SafeEvpCipherCtxHandle ctx = Interop.Crypto.EvpCipherCreatePartial(GetCipher(key.Length * 8)))
111Interop.Crypto.CheckValidOpenSslHandle(ctx);
112Interop.Crypto.EvpCipherSetCcmNonceLength(ctx, nonce.Length);
113Interop.Crypto.EvpCipherSetCcmTag(ctx, tag);
115Interop.Crypto.EvpCipherSetKeyAndIV(ctx, key, nonce, Interop.Crypto.EvpCipherDirection.Decrypt);
120Interop.Crypto.EvpCipherSetInputLength(ctx, ciphertext.Length);
122if (!Interop.Crypto.EvpCipherUpdate(ctx, Span<byte>.Empty, out _, associatedData))
124throw Interop.Crypto.CreateOpenSslCryptographicException();
128if (!Interop.Crypto.EvpCipherUpdate(ctx, plaintext, out int plaintextBytesWritten, ciphertext))
157case 128: return Interop.Crypto.EvpAes128Ccm();
158case 192: return Interop.Crypto.EvpAes192Ccm();
159case 256: return Interop.Crypto.EvpAes256Ccm();
System\Security\Cryptography\AesGcm.OpenSsl.cs (25)
20_ctxHandle = Interop.Crypto.EvpCipherCreatePartial(GetCipher(key.Length * 8));
22Interop.Crypto.CheckValidOpenSslHandle(_ctxHandle);
23Interop.Crypto.EvpCipherSetKeyAndIV(
27Interop.Crypto.EvpCipherDirection.NoChange);
28Interop.Crypto.EvpCipherSetGcmNonceLength(_ctxHandle, NonceSize);
38Interop.Crypto.EvpCipherSetKeyAndIV(
42Interop.Crypto.EvpCipherDirection.Encrypt);
46if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
48throw Interop.Crypto.CreateOpenSslCryptographicException();
52if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, ciphertext, out int ciphertextBytesWritten, plaintext))
54throw Interop.Crypto.CreateOpenSslCryptographicException();
57if (!Interop.Crypto.EvpCipherFinalEx(
62throw Interop.Crypto.CreateOpenSslCryptographicException();
73Interop.Crypto.EvpCipherGetGcmTag(_ctxHandle, tag);
83Interop.Crypto.EvpCipherSetKeyAndIV(
87Interop.Crypto.EvpCipherDirection.Decrypt);
91if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
93throw Interop.Crypto.CreateOpenSslCryptographicException();
97if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, plaintext, out int plaintextBytesWritten, ciphertext))
99throw Interop.Crypto.CreateOpenSslCryptographicException();
102Interop.Crypto.EvpCipherSetGcmTag(_ctxHandle, tag);
104if (!Interop.Crypto.EvpCipherFinalEx(
126case 128: return Interop.Crypto.EvpAes128Gcm();
127case 192: return Interop.Crypto.EvpAes192Gcm();
128case 256: return Interop.Crypto.EvpAes256Gcm();
System\Security\Cryptography\AesImplementation.OpenSsl.cs (12)
45(128, CipherMode.CBC) => Interop.Crypto.EvpAes128Cbc(),
46(128, CipherMode.ECB) => Interop.Crypto.EvpAes128Ecb(),
47(128, CipherMode.CFB) when feedback == 8 => Interop.Crypto.EvpAes128Cfb8(),
48(128, CipherMode.CFB) when feedback == 128 => Interop.Crypto.EvpAes128Cfb128(),
50(192, CipherMode.CBC) => Interop.Crypto.EvpAes192Cbc(),
51(192, CipherMode.ECB) => Interop.Crypto.EvpAes192Ecb(),
52(192, CipherMode.CFB) when feedback == 8 => Interop.Crypto.EvpAes192Cfb8(),
53(192, CipherMode.CFB) when feedback == 128 => Interop.Crypto.EvpAes192Cfb128(),
55(256, CipherMode.CBC) => Interop.Crypto.EvpAes256Cbc(),
56(256, CipherMode.ECB) => Interop.Crypto.EvpAes256Ecb(),
57(256, CipherMode.CFB) when feedback == 8 => Interop.Crypto.EvpAes256Cfb8(),
58(256, CipherMode.CFB) when feedback == 128 => Interop.Crypto.EvpAes256Cfb128(),
System\Security\Cryptography\ChaCha20Poly1305.OpenSsl.cs (23)
13Interop.Crypto.EvpChaCha20Poly1305() != IntPtr.Zero;
20_ctxHandle = Interop.Crypto.EvpCipherCreatePartial(GetCipher(key.Length * 8));
22Interop.Crypto.CheckValidOpenSslHandle(_ctxHandle);
23Interop.Crypto.EvpCipherSetKeyAndIV(
27Interop.Crypto.EvpCipherDirection.NoChange);
37Interop.Crypto.EvpCipherSetKeyAndIV(
41Interop.Crypto.EvpCipherDirection.Encrypt);
45if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
47throw Interop.Crypto.CreateOpenSslCryptographicException();
51if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, ciphertext, out int ciphertextBytesWritten, plaintext))
53throw Interop.Crypto.CreateOpenSslCryptographicException();
56if (!Interop.Crypto.EvpCipherFinalEx(
61throw Interop.Crypto.CreateOpenSslCryptographicException();
72Interop.Crypto.EvpCipherGetAeadTag(_ctxHandle, tag);
82Interop.Crypto.EvpCipherSetKeyAndIV(
86Interop.Crypto.EvpCipherDirection.Decrypt);
90if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
92throw Interop.Crypto.CreateOpenSslCryptographicException();
96if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, plaintext, out int plaintextBytesWritten, ciphertext))
98throw Interop.Crypto.CreateOpenSslCryptographicException();
101Interop.Crypto.EvpCipherSetAeadTag(_ctxHandle, tag);
103if (!Interop.Crypto.EvpCipherFinalEx(
125case 256: return Interop.Crypto.EvpChaCha20Poly1305();
System\Security\Cryptography\HashProviderDispenser.OpenSsl.cs (8)
18HashAlgorithmNames.KMAC128 => Interop.Crypto.EvpMacAlgs.Kmac128 is not null,
19HashAlgorithmNames.KMAC256 => Interop.Crypto.EvpMacAlgs.Kmac256 is not null,
36HashAlgorithmNames.KMAC128 => Interop.Crypto.EvpMacAlgs.Kmac128,
37HashAlgorithmNames.KMAC256 => Interop.Crypto.EvpMacAlgs.Kmac256,
42Interop.Crypto.EvpMacOneShot(macHandle, key, customizationString, source, destination, xof);
47IntPtr evpType = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId);
51int ret = Interop.Crypto.EvpDigestXOFOneShot(evpType, source, destination);
56throw Interop.Crypto.CreateOpenSslCryptographicException();
System\Security\Cryptography\LiteHash.Unix.cs (37)
14IntPtr algorithm = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId);
20IntPtr algorithm = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId);
26IntPtr algorithm = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId);
43_ctx = Interop.Crypto.EvpMdCtxCreate(algorithm);
44Interop.Crypto.CheckValidOpenSslHandle(_ctx);
60Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length));
65Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithm));
70Check(Interop.Crypto.EvpDigestFinalXOF(_ctx, destination));
83Check(Interop.Crypto.EvpDigestCurrentXOF(_ctx, destination));
88SafeEvpMdCtxHandle clone = Interop.Crypto.EvpMdCtxCopyEx(_ctx);
89Interop.Crypto.CheckValidOpenSslHandle(clone);
95Check(Interop.Crypto.EvpDigestSqueeze(_ctx, destination));
110throw Interop.Crypto.CreateOpenSslCryptographicException();
128_hashSizeInBytes = Interop.Crypto.EvpMdSize(algorithm);
130if (_hashSizeInBytes <= 0 || _hashSizeInBytes > Interop.Crypto.EVP_MAX_MD_SIZE)
132Debug.Fail($"Unexpected hash '{_hashSizeInBytes}' size from {nameof(Interop.Crypto.EvpMdSize)}.");
136_ctx = Interop.Crypto.EvpMdCtxCreate(algorithm);
137Interop.Crypto.CheckValidOpenSslHandle(_ctx);
154Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length));
162Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
170Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithm));
176Check(Interop.Crypto.EvpDigestCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
183SafeEvpMdCtxHandle clone = Interop.Crypto.EvpMdCtxCopyEx(_ctx);
184Interop.Crypto.CheckValidOpenSslHandle(clone);
200throw Interop.Crypto.CreateOpenSslCryptographicException();
215_hashSizeInBytes = Interop.Crypto.EvpMdSize(algorithm);
217if (_hashSizeInBytes <= 0 || _hashSizeInBytes > Interop.Crypto.EVP_MAX_MD_SIZE)
219Debug.Fail($"Unexpected hash '{_hashSizeInBytes}' size from {nameof(Interop.Crypto.EvpMdSize)}.");
223_ctx = Interop.Crypto.HmacCreate(ref MemoryMarshal.GetReference(key), key.Length, algorithm);
224Interop.Crypto.CheckValidOpenSslHandle(_ctx);
240Check(Interop.Crypto.HmacUpdate(_ctx, data, data.Length));
248Check(Interop.Crypto.HmacCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
258Check(Interop.Crypto.HmacFinal(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
265Check(Interop.Crypto.HmacReset(_ctx));
270SafeHmacCtxHandle clone = Interop.Crypto.HmacCopy(_ctx);
271Interop.Crypto.CheckValidOpenSslHandle(clone);
287throw Interop.Crypto.CreateOpenSslCryptographicException();
System\Security\Cryptography\X509Certificates\OpenSslX509CertificateReader.cs (82)
30return new OpenSslX509CertificateReader(Interop.Crypto.X509UpRef(handle));
78using (SafeBioHandle fileBio = Interop.Crypto.BioNewFile(fileName, "rb"))
80Interop.Crypto.CheckValidOpenSslHandle(fileBio);
108int bioPosition = Interop.Crypto.BioTell(bio);
147int ret = Interop.Crypto.BioSeek(bio, bioPosition);
151throw Interop.Crypto.CreateOpenSslCryptographicException();
157SafeX509Handle certHandle = Interop.Crypto.DecodeX509(
165Interop.Crypto.ErrClearError();
175SafeX509Handle cert = Interop.Crypto.PemReadX509FromBioAux(bio);
181Interop.Crypto.ErrClearError();
191SafeX509Handle cert = Interop.Crypto.PemReadX509FromBio(bio);
197Interop.Crypto.ErrClearError();
207using (SafeBioHandle bio = Interop.Crypto.CreateMemoryBio())
209Interop.Crypto.CheckValidOpenSslHandle(bio);
211if (Interop.Crypto.BioWrite(bio, rawData) != rawData.Length)
213Interop.Crypto.ErrClearError();
222SafeX509Handle cert = Interop.Crypto.ReadX509AsDerFromBio(bio);
228Interop.Crypto.ErrClearError();
240bool init = Interop.Crypto.X509CheckPurpose(handle, -1, 0);
244throw Interop.Crypto.CreateOpenSslCryptographicException();
273return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetIssuerName(cert)).Name;
286return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetSubjectName(cert)).Name;
299return Interop.Crypto.GetX509Thumbprint(_cert);
308IntPtr oidPtr = Interop.Crypto.GetX509PublicKeyAlgorithm(cert);
309return Interop.Crypto.GetOidValue(oidPtr);
318return Interop.Crypto.GetX509PublicKeyParameterBytes(_cert);
327IntPtr keyBytesPtr = Interop.Crypto.GetX509PublicKeyBytes(cert);
328return Interop.Crypto.GetAsn1StringBytes(keyBytesPtr);
337using (SafeSharedAsn1IntegerHandle serialNumber = Interop.Crypto.X509GetSerialNumber(_cert))
339return Interop.Crypto.GetAsn1IntegerBytes(serialNumber);
349IntPtr oidPtr = Interop.Crypto.GetX509SignatureAlgorithm(cert);
350return Interop.Crypto.GetOidValue(oidPtr);
361return ExtractValidityDateTime(Interop.Crypto.GetX509NotAfter(cert));
371return ExtractValidityDateTime(Interop.Crypto.GetX509NotBefore(cert));
380return Interop.Crypto.OpenSslEncode(
381Interop.Crypto.GetX509DerSize,
382Interop.Crypto.EncodeX509,
391int version = Interop.Crypto.GetX509Version(_cert);
429return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetSubjectName(cert));
439return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetIssuerName(cert));
449int extensionCount = Interop.Crypto.X509GetExtCount(cert);
453IntPtr ext = Interop.Crypto.X509GetExt(cert, i);
454Interop.Crypto.CheckValidOpenSslHandle(ext);
456IntPtr oidPtr = Interop.Crypto.X509ExtensionGetOid(ext);
457Interop.Crypto.CheckValidOpenSslHandle(oidPtr);
458string oidValue = Interop.Crypto.GetOidValue(oidPtr);
460IntPtr dataPtr = Interop.Crypto.X509ExtensionGetData(ext);
461Interop.Crypto.CheckValidOpenSslHandle(dataPtr);
466policyData.ApplicationCertPolicies = Interop.Crypto.GetAsn1StringBytes(dataPtr);
469policyData.CertPolicies = Interop.Crypto.GetAsn1StringBytes(dataPtr);
472policyData.CertPolicyMappings = Interop.Crypto.GetAsn1StringBytes(dataPtr);
475policyData.CertPolicyConstraints = Interop.Crypto.GetAsn1StringBytes(dataPtr);
478policyData.EnhancedKeyUsage = Interop.Crypto.GetAsn1StringBytes(dataPtr);
481policyData.InhibitAnyPolicyExtension = Interop.Crypto.GetAsn1StringBytes(dataPtr);
495int extensionCount = Interop.Crypto.X509GetExtCount(cert);
500IntPtr ext = Interop.Crypto.X509GetExt(cert, i);
502Interop.Crypto.CheckValidOpenSslHandle(ext);
504IntPtr oidPtr = Interop.Crypto.X509ExtensionGetOid(ext);
506Interop.Crypto.CheckValidOpenSslHandle(oidPtr);
508string oidValue = Interop.Crypto.GetOidValue(oidPtr);
511IntPtr dataPtr = Interop.Crypto.X509ExtensionGetData(ext);
513Interop.Crypto.CheckValidOpenSslHandle(dataPtr);
515byte[] extData = Interop.Crypto.GetAsn1StringBytes(dataPtr);
516bool critical = Interop.Crypto.X509ExtensionGetCritical(ext);
528int nid = Interop.Crypto.ResolveRequiredNid(oidValue);
530using (SafeSharedAsn1OctetStringHandle data = Interop.Crypto.X509FindExtensionData(cert, nid))
537return Interop.Crypto.RentAsn1StringBytes(data.DangerousGetHandle());
573using (SafeEvpPKeyHandle publicKeyHandle = Interop.Crypto.GetX509EvpPublicKey(_cert))
575Interop.Crypto.CheckValidOpenSslHandle(publicKeyHandle);
583using (SafeEvpPKeyHandle publicKeyHandle = Interop.Crypto.GetX509EvpPublicKey(_cert))
585Interop.Crypto.CheckValidOpenSslHandle(publicKeyHandle);
615SafeX509Handle certHandle = Interop.Crypto.X509UpRef(_cert);
705using (SafeBioHandle bioHandle = Interop.Crypto.GetX509NameInfo(_cert, (int)nameType, forIssuer))
712int bioSize = Interop.Crypto.GetMemoryBioSize(bioHandle);
721read = Interop.Crypto.BioGets(bioHandle, current);
725throw Interop.Crypto.CreateOpenSslCryptographicException();
767SafeX509Handle certHandle = Interop.Crypto.X509UpRef(_cert);
781byte[] bytes = Interop.Crypto.GetAsn1StringBytes(validityDatePtr);
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (102)
16using X509VerifyStatusCodeUniversal = Interop.Crypto.X509VerifyStatusCodeUniversal;
22private delegate X509ChainStatusFlags MapVersionSpecificCode(Interop.Crypto.X509VerifyStatusCode code);
111untrusted = Interop.Crypto.NewX509Stack();
112Interop.Crypto.X509StackAddMultiple(untrusted, s_userIntermediateStore.GetNativeCollection());
113Interop.Crypto.X509StackAddMultiple(untrusted, s_userPersonalStore.GetNativeCollection());
117Interop.Crypto.X509StackAddMultiple(untrusted, systemIntermediate);
118Interop.Crypto.X509StoreSetVerifyTime(store, verificationTime);
120storeCtx = Interop.Crypto.X509StoreCtxCreate();
122if (!Interop.Crypto.X509StoreCtxInit(storeCtx, store, leafHandle, untrusted))
124throw Interop.Crypto.CreateOpenSslCryptographicException();
152using (SafeX509StackHandle customTrust = Interop.Crypto.NewX509Stack())
167return Interop.Crypto.X509ChainNew(customTrust, SafeX509StackHandle.InvalidHandle);
171return Interop.Crypto.X509ChainNew(systemTrust, s_userRootStore.GetNativeCollection());
174internal Interop.Crypto.X509VerifyStatusCode FindFirstChain(X509Certificate2Collection? extraCerts)
179Interop.Crypto.X509VerifyCert(storeCtx);
180Interop.Crypto.X509VerifyStatusCode statusCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
196Interop.Crypto.X509StoreCtxRebuildChain(storeCtx);
197statusCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
203internal static bool IsCompleteChain(Interop.Crypto.X509VerifyStatusCode statusCode)
215internal Interop.Crypto.X509VerifyStatusCode FindChainViaAia(
221Interop.Crypto.X509VerifyStatusCode statusCode =
226using (SafeX509Handle currentCert = Interop.Crypto.X509StoreCtxGetCurrentCert(storeCtx))
270Interop.Crypto.X509StoreCtxRebuildChain(storeCtx);
271statusCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
275if (statusCode == Interop.Crypto.X509VerifyStatusCode.X509_V_OK && downloadedCerts != null)
277using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
279int chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack);
296tempChain[i] = Interop.Crypto.GetX509StackField(chainStack, i);
339Interop.Crypto.X509StoreCtxCommitToChain(_storeCtx);
361using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
363chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack);
388if (i == 0 && Interop.Crypto.X509ChainHasStapledOcsp(_storeCtx))
398Interop.Crypto.X509UpRef(Interop.Crypto.GetX509StackField(chainStack, i)))
411Interop.Crypto.X509StoreSetRevocationFlag(_store, revocationFlag);
412Interop.Crypto.X509StoreCtxRebuildChain(_storeCtx);
415Interop.Crypto.X509VerifyStatusCode errorCode = Interop.Crypto.X509StoreCtxGetError(_storeCtx);
424if (errorCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
465Interop.Crypto.X509VerifyStatusCode statusCode;
487if (statusCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
497using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
536using (SafeSharedX509StackHandle untrusted = Interop.Crypto.X509StoreCtxGetSharedUntrusted(_storeCtx))
537using (SafeX509Handle upref = Interop.Crypto.X509UpRef(_leafHandle))
539Interop.Crypto.PushX509StackField(untrusted, upref);
545IntPtr rootPtr = Interop.Crypto.GetX509StackField(chainStack, start);
547using (SafeX509Handle rootHandle = Interop.Crypto.X509UpRef(rootPtr))
552if (statusCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
608IntPtr certPtr = Interop.Crypto.GetX509StackField(chainStack, i);
610using (SafeX509Handle certHandle = Interop.Crypto.X509UpRef(certPtr))
616if (statusCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
649return ((WorkingChain*)Interop.Crypto.X509StoreCtxGetAppData(storeCtx))->VerifyCallback(storeCtx);
668Interop.Crypto.X509StoreCtxReset(_storeCtx);
670Interop.Crypto.X509StoreCtxSetVerifyCallback(_storeCtx, &VerifyCallback, &workingChain);
672bool verify = Interop.Crypto.X509VerifyCert(_storeCtx);
683Interop.Crypto.X509StoreCtxSetVerifyCallback(_storeCtx, &VerifyCallback, &workingChain);
685verify = Interop.Crypto.X509VerifyCert(_storeCtx);
704if (Interop.Crypto.X509StoreCtxGetError(_storeCtx) != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
730Interop.Crypto.X509StoreCtxResetForSignatureError(_storeCtx, out newStore);
739private Interop.Crypto.X509VerifyStatusCode CheckOcsp(
750Interop.Crypto.X509VerifyStatusCode status =
751Interop.Crypto.X509ChainGetCachedOcspStatus(_storeCtx, ocspCache, chainDepth);
775using (SafeOcspRequestHandle req = Interop.Crypto.X509ChainBuildOcspRequest(_storeCtx, chainDepth))
777ArraySegment<byte> encoded = Interop.Crypto.OpenSslRentEncode(
778Interop.Crypto.GetOcspRequestDerSize,
779Interop.Crypto.EncodeOcspRequest,
816status = Interop.Crypto.X509ChainVerifyOcsp(_storeCtx, req, resp, ocspCache, chainDepth);
850using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
852int chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack);
884IntPtr elementCertPtr = Interop.Crypto.GetX509StackField(chainStack, i);
888throw Interop.Crypto.CreateOpenSslCryptographicException();
971foreach (Interop.Crypto.X509VerifyStatusCode errorCode in errorCodes)
996Interop.Crypto.X509VerifyStatusCode errorCode,
1073private static X509ChainStatusFlags MapVerifyErrorToChainStatus(Interop.Crypto.X509VerifyStatusCode code)
1162private static X509ChainStatusFlags MapOpenSsl30Code(Interop.Crypto.X509VerifyStatusCode code)
1166case Interop.Crypto.X509VerifyStatusCode30.X509_V_ERR_INVALID_CA:
1174private static X509ChainStatusFlags MapOpenSsl102Code(Interop.Crypto.X509VerifyStatusCode code)
1178case Interop.Crypto.X509VerifyStatusCode102.X509_V_ERR_INVALID_CA:
1186private static X509ChainStatusFlags MapOpenSsl111Code(Interop.Crypto.X509VerifyStatusCode code)
1190case Interop.Crypto.X509VerifyStatusCode111.X509_V_ERR_INVALID_CA:
1288using (SafeX509Handle tmp = Interop.Crypto.X509UpRef(cert))
1290if (!Interop.Crypto.PushX509StackField(stack, tmp))
1292throw Interop.Crypto.CreateOpenSslCryptographicException();
1302using (SafeX509Handle tmp = Interop.Crypto.X509UpRef(cert))
1304if (!Interop.Crypto.PushX509StackField(stack, tmp))
1306throw Interop.Crypto.CreateOpenSslCryptographicException();
1314private static string GetErrorString(Interop.Crypto.X509VerifyStatusCode code)
1318Interop.Crypto.GetX509VerifyCertErrorString);
1360Interop.Crypto.X509VerifyStatusCode errorCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
1361int errorDepth = Interop.Crypto.X509StoreCtxGetErrorDepth(storeCtx);
1435internal void Add(Interop.Crypto.X509VerifyStatusCode statusCode)
1441private void ClearError(Interop.Crypto.X509VerifyStatusCode statusCode)
1447private bool HasError(Interop.Crypto.X509VerifyStatusCode statusCode)
1540foreach (Interop.Crypto.X509VerifyStatusCode code in this)
1551private static int FindBucket(Interop.Crypto.X509VerifyStatusCode statusCode, out int bitValue)
1578foreach (Interop.Crypto.X509VerifyStatusCode code in coll)
1649public Interop.Crypto.X509VerifyStatusCode Current =>
1651Interop.Crypto.X509VerifyStatusCode.X509_V_OK :
1652(Interop.Crypto.X509VerifyStatusCode)(_lastBit + 32 * _lastBucket);