System\Security\Cryptography\AesCcm.OpenSsl.cs (30)
14public static bool IsSupported { get; } = Interop.OpenSslNoInit.OpenSslIsAvailable;
40using (SafeEvpCipherCtxHandle ctx = Interop.Crypto.EvpCipherCreatePartial(GetCipher(key.Length * 8)))
42Interop.Crypto.CheckValidOpenSslHandle(ctx);
46Interop.Crypto.EvpCipherSetKeyAndIV(ctx, Span<byte>.Empty, Span<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 (26)
14public static bool IsSupported { get; } = Interop.OpenSslNoInit.OpenSslIsAvailable;
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 (24)
12public static bool IsSupported { get; } = Interop.OpenSslNoInit.OpenSslIsAvailable &&
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 (33)
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));
76Check(Interop.Crypto.EvpDigestCurrentXOF(_ctx, destination));
81SafeEvpMdCtxHandle clone = Interop.Crypto.EvpMdCtxCopyEx(_ctx);
82Interop.Crypto.CheckValidOpenSslHandle(clone);
88Check(Interop.Crypto.EvpDigestSqueeze(_ctx, destination));
103throw Interop.Crypto.CreateOpenSslCryptographicException();
121_hashSizeInBytes = Interop.Crypto.EvpMdSize(algorithm);
123if (_hashSizeInBytes <= 0 || _hashSizeInBytes > Interop.Crypto.EVP_MAX_MD_SIZE)
125Debug.Fail($"Unexpected hash '{_hashSizeInBytes}' size from {nameof(Interop.Crypto.EvpMdSize)}.");
129_ctx = Interop.Crypto.EvpMdCtxCreate(algorithm);
130Interop.Crypto.CheckValidOpenSslHandle(_ctx);
140Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length));
148Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
156Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithm));
162Check(Interop.Crypto.EvpDigestCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
179throw Interop.Crypto.CreateOpenSslCryptographicException();
194_hashSizeInBytes = Interop.Crypto.EvpMdSize(algorithm);
196if (_hashSizeInBytes <= 0 || _hashSizeInBytes > Interop.Crypto.EVP_MAX_MD_SIZE)
198Debug.Fail($"Unexpected hash '{_hashSizeInBytes}' size from {nameof(Interop.Crypto.EvpMdSize)}.");
202_ctx = Interop.Crypto.HmacCreate(ref MemoryMarshal.GetReference(key), key.Length, algorithm);
203Interop.Crypto.CheckValidOpenSslHandle(_ctx);
213Check(Interop.Crypto.HmacUpdate(_ctx, data, data.Length));
221Check(Interop.Crypto.HmacCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
231Check(Interop.Crypto.HmacFinal(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
238Check(Interop.Crypto.HmacReset(_ctx));
253throw Interop.Crypto.CreateOpenSslCryptographicException();
System\Security\Cryptography\X509Certificates\OpenSslCachedSystemStoreProvider.cs (21)
57int count = Interop.Crypto.GetX509StackFieldCount(nativeColl);
61X509Certificate2 clone = new X509Certificate2(Interop.Crypto.GetX509StackField(nativeColl, i));
148SafeX509StackHandle rootStore = Interop.Crypto.NewX509Stack();
149Interop.Crypto.CheckValidOpenSslHandle(rootStore);
150SafeX509StackHandle intermedStore = Interop.Crypto.NewX509Stack();
151Interop.Crypto.CheckValidOpenSslHandle(intermedStore);
223using (SafeBioHandle fileBio = Interop.Crypto.BioNewFile(file, "rb"))
228Interop.Crypto.ErrClearError();
249using (SafeX509Handle tmp = Interop.Crypto.X509UpRef(pal.Handle))
251if (!Interop.Crypto.PushX509StackField(rootStore, tmp))
253throw Interop.Crypto.CreateOpenSslCryptographicException();
267using (SafeX509Handle tmp = Interop.Crypto.X509UpRef(pal.Handle))
269if (!Interop.Crypto.PushX509StackField(intermedStore, tmp))
271throw Interop.Crypto.CreateOpenSslCryptographicException();
326string? rootFile = Interop.Crypto.GetX509RootStoreFile();
338string rootDirectory = Interop.Crypto.GetX509RootStorePath(out isDefault) ?? "";
373=> TryStat(path, Interop.Sys.FileTypes.S_IFDIR, out lastModified, out _);
376=> TryStat(path, Interop.Sys.FileTypes.S_IFREG, out lastModified, out fileId);
383if (Interop.Sys.Stat(path, out Interop.Sys.FileStatus status) < 0 ||
384(status.Mode & Interop.Sys.FileTypes.S_IFMT) != fileType)
System\Security\Cryptography\X509Certificates\OpenSslX509CertificateReader.cs (82)
31return new OpenSslX509CertificateReader(Interop.Crypto.X509UpRef(handle));
77using (SafeBioHandle fileBio = Interop.Crypto.BioNewFile(fileName, "rb"))
79Interop.Crypto.CheckValidOpenSslHandle(fileBio);
107int bioPosition = Interop.Crypto.BioTell(bio);
146int ret = Interop.Crypto.BioSeek(bio, bioPosition);
150throw Interop.Crypto.CreateOpenSslCryptographicException();
156SafeX509Handle certHandle = Interop.Crypto.DecodeX509(
164Interop.Crypto.ErrClearError();
174SafeX509Handle cert = Interop.Crypto.PemReadX509FromBioAux(bio);
180Interop.Crypto.ErrClearError();
190SafeX509Handle cert = Interop.Crypto.PemReadX509FromBio(bio);
196Interop.Crypto.ErrClearError();
206using (SafeBioHandle bio = Interop.Crypto.CreateMemoryBio())
208Interop.Crypto.CheckValidOpenSslHandle(bio);
210if (Interop.Crypto.BioWrite(bio, rawData) != rawData.Length)
212Interop.Crypto.ErrClearError();
221SafeX509Handle cert = Interop.Crypto.ReadX509AsDerFromBio(bio);
227Interop.Crypto.ErrClearError();
239bool init = Interop.Crypto.X509CheckPurpose(handle, -1, 0);
243throw Interop.Crypto.CreateOpenSslCryptographicException();
272return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetIssuerName(cert)).Name;
285return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetSubjectName(cert)).Name;
298return Interop.Crypto.GetX509Thumbprint(_cert);
307IntPtr oidPtr = Interop.Crypto.GetX509PublicKeyAlgorithm(cert);
308return Interop.Crypto.GetOidValue(oidPtr);
317return Interop.Crypto.GetX509PublicKeyParameterBytes(_cert);
326IntPtr keyBytesPtr = Interop.Crypto.GetX509PublicKeyBytes(cert);
327return Interop.Crypto.GetAsn1StringBytes(keyBytesPtr);
336using (SafeSharedAsn1IntegerHandle serialNumber = Interop.Crypto.X509GetSerialNumber(_cert))
338return Interop.Crypto.GetAsn1IntegerBytes(serialNumber);
348IntPtr oidPtr = Interop.Crypto.GetX509SignatureAlgorithm(cert);
349return Interop.Crypto.GetOidValue(oidPtr);
360return ExtractValidityDateTime(Interop.Crypto.GetX509NotAfter(cert));
370return ExtractValidityDateTime(Interop.Crypto.GetX509NotBefore(cert));
379return Interop.Crypto.OpenSslEncode(
380Interop.Crypto.GetX509DerSize,
381Interop.Crypto.EncodeX509,
390int version = Interop.Crypto.GetX509Version(_cert);
428return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetSubjectName(cert));
438return Interop.Crypto.LoadX500Name(Interop.Crypto.X509GetIssuerName(cert));
448int extensionCount = Interop.Crypto.X509GetExtCount(cert);
452IntPtr ext = Interop.Crypto.X509GetExt(cert, i);
453Interop.Crypto.CheckValidOpenSslHandle(ext);
455IntPtr oidPtr = Interop.Crypto.X509ExtensionGetOid(ext);
456Interop.Crypto.CheckValidOpenSslHandle(oidPtr);
457string oidValue = Interop.Crypto.GetOidValue(oidPtr);
459IntPtr dataPtr = Interop.Crypto.X509ExtensionGetData(ext);
460Interop.Crypto.CheckValidOpenSslHandle(dataPtr);
465policyData.ApplicationCertPolicies = Interop.Crypto.GetAsn1StringBytes(dataPtr);
468policyData.CertPolicies = Interop.Crypto.GetAsn1StringBytes(dataPtr);
471policyData.CertPolicyMappings = Interop.Crypto.GetAsn1StringBytes(dataPtr);
474policyData.CertPolicyConstraints = Interop.Crypto.GetAsn1StringBytes(dataPtr);
477policyData.EnhancedKeyUsage = Interop.Crypto.GetAsn1StringBytes(dataPtr);
480policyData.InhibitAnyPolicyExtension = Interop.Crypto.GetAsn1StringBytes(dataPtr);
494int extensionCount = Interop.Crypto.X509GetExtCount(cert);
499IntPtr ext = Interop.Crypto.X509GetExt(cert, i);
501Interop.Crypto.CheckValidOpenSslHandle(ext);
503IntPtr oidPtr = Interop.Crypto.X509ExtensionGetOid(ext);
505Interop.Crypto.CheckValidOpenSslHandle(oidPtr);
507string oidValue = Interop.Crypto.GetOidValue(oidPtr);
510IntPtr dataPtr = Interop.Crypto.X509ExtensionGetData(ext);
512Interop.Crypto.CheckValidOpenSslHandle(dataPtr);
514byte[] extData = Interop.Crypto.GetAsn1StringBytes(dataPtr);
515bool critical = Interop.Crypto.X509ExtensionGetCritical(ext);
527int nid = Interop.Crypto.ResolveRequiredNid(oidValue);
529using (SafeSharedAsn1OctetStringHandle data = Interop.Crypto.X509FindExtensionData(cert, nid))
536return Interop.Crypto.RentAsn1StringBytes(data.DangerousGetHandle());
572using (SafeEvpPKeyHandle publicKeyHandle = Interop.Crypto.GetX509EvpPublicKey(_cert))
574Interop.Crypto.CheckValidOpenSslHandle(publicKeyHandle);
582using (SafeEvpPKeyHandle publicKeyHandle = Interop.Crypto.GetX509EvpPublicKey(_cert))
584Interop.Crypto.CheckValidOpenSslHandle(publicKeyHandle);
614SafeX509Handle certHandle = Interop.Crypto.X509UpRef(_cert);
704using (SafeBioHandle bioHandle = Interop.Crypto.GetX509NameInfo(_cert, (int)nameType, forIssuer))
711int bioSize = Interop.Crypto.GetMemoryBioSize(bioHandle);
720read = Interop.Crypto.BioGets(bioHandle, current);
724throw Interop.Crypto.CreateOpenSslCryptographicException();
766SafeX509Handle certHandle = Interop.Crypto.X509UpRef(_cert);
780byte[] bytes = Interop.Crypto.GetAsn1StringBytes(validityDatePtr);
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (102)
16using X509VerifyStatusCodeUniversal = Interop.Crypto.X509VerifyStatusCodeUniversal;
24private delegate X509ChainStatusFlags MapVersionSpecificCode(Interop.Crypto.X509VerifyStatusCode code);
113untrusted = Interop.Crypto.NewX509Stack();
114Interop.Crypto.X509StackAddMultiple(untrusted, s_userIntermediateStore.GetNativeCollection());
115Interop.Crypto.X509StackAddMultiple(untrusted, s_userPersonalStore.GetNativeCollection());
119Interop.Crypto.X509StackAddMultiple(untrusted, systemIntermediate);
120Interop.Crypto.X509StoreSetVerifyTime(store, verificationTime);
122storeCtx = Interop.Crypto.X509StoreCtxCreate();
124if (!Interop.Crypto.X509StoreCtxInit(storeCtx, store, leafHandle, untrusted))
126throw Interop.Crypto.CreateOpenSslCryptographicException();
154using (SafeX509StackHandle customTrust = Interop.Crypto.NewX509Stack())
169return Interop.Crypto.X509ChainNew(customTrust, SafeX509StackHandle.InvalidHandle);
173return Interop.Crypto.X509ChainNew(systemTrust, s_userRootStore.GetNativeCollection());
176internal Interop.Crypto.X509VerifyStatusCode FindFirstChain(X509Certificate2Collection? extraCerts)
181Interop.Crypto.X509VerifyCert(storeCtx);
182Interop.Crypto.X509VerifyStatusCode statusCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
198Interop.Crypto.X509StoreCtxRebuildChain(storeCtx);
199statusCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
205internal static bool IsCompleteChain(Interop.Crypto.X509VerifyStatusCode statusCode)
217internal Interop.Crypto.X509VerifyStatusCode FindChainViaAia(
223Interop.Crypto.X509VerifyStatusCode statusCode =
228using (SafeX509Handle currentCert = Interop.Crypto.X509StoreCtxGetCurrentCert(storeCtx))
272Interop.Crypto.X509StoreCtxRebuildChain(storeCtx);
273statusCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
277if (statusCode == Interop.Crypto.X509VerifyStatusCode.X509_V_OK && downloadedCerts != null)
279using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
281int chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack);
298tempChain[i] = Interop.Crypto.GetX509StackField(chainStack, i);
341Interop.Crypto.X509StoreCtxCommitToChain(_storeCtx);
363using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
365chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack);
390if (i == 0 && Interop.Crypto.X509ChainHasStapledOcsp(_storeCtx))
400Interop.Crypto.X509UpRef(Interop.Crypto.GetX509StackField(chainStack, i)))
413Interop.Crypto.X509StoreSetRevocationFlag(_store, revocationFlag);
414Interop.Crypto.X509StoreCtxRebuildChain(_storeCtx);
417Interop.Crypto.X509VerifyStatusCode errorCode = Interop.Crypto.X509StoreCtxGetError(_storeCtx);
426if (errorCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
467Interop.Crypto.X509VerifyStatusCode statusCode;
489if (statusCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
499using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
538using (SafeSharedX509StackHandle untrusted = Interop.Crypto.X509StoreCtxGetSharedUntrusted(_storeCtx))
539using (SafeX509Handle upref = Interop.Crypto.X509UpRef(_leafHandle))
541Interop.Crypto.PushX509StackField(untrusted, upref);
547IntPtr rootPtr = Interop.Crypto.GetX509StackField(chainStack, start);
549using (SafeX509Handle rootHandle = Interop.Crypto.X509UpRef(rootPtr))
554if (statusCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
610IntPtr certPtr = Interop.Crypto.GetX509StackField(chainStack, i);
612using (SafeX509Handle certHandle = Interop.Crypto.X509UpRef(certPtr))
618if (statusCode != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
651return ((WorkingChain*)Interop.Crypto.X509StoreCtxGetAppData(storeCtx))->VerifyCallback(storeCtx);
670Interop.Crypto.X509StoreCtxReset(_storeCtx);
672Interop.Crypto.X509StoreCtxSetVerifyCallback(_storeCtx, &VerifyCallback, &workingChain);
674bool verify = Interop.Crypto.X509VerifyCert(_storeCtx);
685Interop.Crypto.X509StoreCtxSetVerifyCallback(_storeCtx, &VerifyCallback, &workingChain);
687verify = Interop.Crypto.X509VerifyCert(_storeCtx);
706if (Interop.Crypto.X509StoreCtxGetError(_storeCtx) != Interop.Crypto.X509VerifyStatusCode.X509_V_OK)
732Interop.Crypto.X509StoreCtxResetForSignatureError(_storeCtx, out newStore);
741private Interop.Crypto.X509VerifyStatusCode CheckOcsp(
752Interop.Crypto.X509VerifyStatusCode status =
753Interop.Crypto.X509ChainGetCachedOcspStatus(_storeCtx, ocspCache, chainDepth);
777using (SafeOcspRequestHandle req = Interop.Crypto.X509ChainBuildOcspRequest(_storeCtx, chainDepth))
779ArraySegment<byte> encoded = Interop.Crypto.OpenSslRentEncode(
780Interop.Crypto.GetOcspRequestDerSize,
781Interop.Crypto.EncodeOcspRequest,
818status = Interop.Crypto.X509ChainVerifyOcsp(_storeCtx, req, resp, ocspCache, chainDepth);
852using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx))
854int chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack);
886IntPtr elementCertPtr = Interop.Crypto.GetX509StackField(chainStack, i);
890throw Interop.Crypto.CreateOpenSslCryptographicException();
973foreach (Interop.Crypto.X509VerifyStatusCode errorCode in errorCodes)
998Interop.Crypto.X509VerifyStatusCode errorCode,
1075private static X509ChainStatusFlags MapVerifyErrorToChainStatus(Interop.Crypto.X509VerifyStatusCode code)
1164private static X509ChainStatusFlags MapOpenSsl30Code(Interop.Crypto.X509VerifyStatusCode code)
1168case Interop.Crypto.X509VerifyStatusCode30.X509_V_ERR_INVALID_CA:
1176private static X509ChainStatusFlags MapOpenSsl102Code(Interop.Crypto.X509VerifyStatusCode code)
1180case Interop.Crypto.X509VerifyStatusCode102.X509_V_ERR_INVALID_CA:
1188private static X509ChainStatusFlags MapOpenSsl111Code(Interop.Crypto.X509VerifyStatusCode code)
1192case Interop.Crypto.X509VerifyStatusCode111.X509_V_ERR_INVALID_CA:
1290using (SafeX509Handle tmp = Interop.Crypto.X509UpRef(cert))
1292if (!Interop.Crypto.PushX509StackField(stack, tmp))
1294throw Interop.Crypto.CreateOpenSslCryptographicException();
1304using (SafeX509Handle tmp = Interop.Crypto.X509UpRef(cert))
1306if (!Interop.Crypto.PushX509StackField(stack, tmp))
1308throw Interop.Crypto.CreateOpenSslCryptographicException();
1316private static string GetErrorString(Interop.Crypto.X509VerifyStatusCode code)
1320Interop.Crypto.GetX509VerifyCertErrorString);
1362Interop.Crypto.X509VerifyStatusCode errorCode = Interop.Crypto.X509StoreCtxGetError(storeCtx);
1363int errorDepth = Interop.Crypto.X509StoreCtxGetErrorDepth(storeCtx);
1437internal void Add(Interop.Crypto.X509VerifyStatusCode statusCode)
1443private void ClearError(Interop.Crypto.X509VerifyStatusCode statusCode)
1449private bool HasError(Interop.Crypto.X509VerifyStatusCode statusCode)
1542foreach (Interop.Crypto.X509VerifyStatusCode code in this)
1553private static int FindBucket(Interop.Crypto.X509VerifyStatusCode statusCode, out int bitValue)
1580foreach (Interop.Crypto.X509VerifyStatusCode code in coll)
1651public Interop.Crypto.X509VerifyStatusCode Current =>
1653Interop.Crypto.X509VerifyStatusCode.X509_V_OK :
1654(Interop.Crypto.X509VerifyStatusCode)(_lastBit + 32 * _lastBucket);