Class CertificateManager
Definition
- Namespace:
- Tizen.Security.SecureRepository
- Assembly:
- Tizen.Security.SecureRepository.dll
This class provides the methods handling certificates.
public class CertificateManager : Manager
- Inheritance
Methods
View SourceCheckOcsp(IEnumerable<Certificate>)
Perform OCSP, which checks whether the certificate is revoked or not.
Declaration
public static OcspStatus CheckOcsp(IEnumerable<Certificate> certificateChain)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><Certificate> | certificateChain | Valid certificate chain to perform the OCSP check. |
Returns
Type | Description |
---|---|
OcspStatus | A status result of the OCSP check. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The certificateChain argument is null. |
System.ArgumentException | The certificateChain is not valid chain or certificate. |
System.InvalidOperationException | Some of the certificates in chain are expired or not valid yet. |
Get(string, string)
Gets a certificate from the secure repository.
Declaration
public static Certificate Get(string alias, string password)
Parameters
Type | Name | Description |
---|---|---|
string | alias | The name of a certificate to be retrieved. |
string | password | The password used in decrypting a certificate value. If password of policy is provided in SaveCertificate(), the same password should be provided. |
Returns
Type | Description |
---|---|
Certificate | A certificate specified by alias. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The alias argument is null. |
System.ArgumentException | The alias argument is in an invalid format. |
System.InvalidOperationException | The certificate does not exist with the alias or certificate-protecting password isn't matched. |
GetAliases()
Gets all aliases of certificates, which the client can access.
Declaration
public static IEnumerable<string> GetAliases()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><string> | All aliases of certificates, which the client can access. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | No alias to get. |
GetCertificateChain(Certificate, IEnumerable<Certificate>, IEnumerable<Certificate>, bool)
Verifies a certificate chain and returns that chain using user entered trusted and untrusted CA certificates.
Declaration
public static IEnumerable<Certificate> GetCertificateChain(Certificate certificate, IEnumerable<Certificate> untrustedCertificates, IEnumerable<Certificate> trustedCertificates, bool useTrustedSystemCertificates)
Parameters
Type | Name | Description |
---|---|---|
Certificate | certificate | The certificate to be verified. |
System.Collections.Generic.IEnumerable<T><Certificate> | untrustedCertificates | The untrusted CA certificates to be used in verifying a certificate chain. |
System.Collections.Generic.IEnumerable<T><Certificate> | trustedCertificates | The trusted CA certificates to be used in verifying a certificate chain. |
bool | useTrustedSystemCertificates | The flag indicating the use of the trusted root certificates in the system's certificate storage. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Certificate> | A newly created certificate chain. |
Remarks
The trusted root certificate of the chain in the system's certificate storage is added to the certificate chain.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The certificate argument is null. |
System.ArgumentException | Some of the certificates in arguments are invalid. |
System.InvalidOperationException | Some of the certificates in arguments are expired or not valid yet. Certificate cannot build chain. The root certificate is not in the trusted system certificate store. |
GetCertificateChain(Certificate, IEnumerable<Certificate>)
Verifies a certificate chain and returns that chain.
Declaration
public static IEnumerable<Certificate> GetCertificateChain(Certificate certificate, IEnumerable<Certificate> untrustedCertificates)
Parameters
Type | Name | Description |
---|---|---|
Certificate | certificate | The certificate to be verified. |
System.Collections.Generic.IEnumerable<T><Certificate> | untrustedCertificates | The untrusted CA certificates to be used in verifying a certificate chain. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Certificate> | A newly created certificate chain. |
Remarks
The trusted root certificate of the chain should exist in the system's certificate storage.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The certificate argument is null. |
System.ArgumentException | Some of the certificates in arguments are invalid. |
System.InvalidOperationException | Some of the certificates in arguments are expired or not valid yet. Certificate cannot build chain. The root certificate is not in the trusted system certificate store. |
Save(string, Certificate, Policy)
Stores a certificate inside the secure repository based on the provided policy.
Declaration
public static void Save(string alias, Certificate cert, Policy policy)
Parameters
Type | Name | Description |
---|---|---|
string | alias | The name of a certificate to be stored. |
Certificate | cert | The certificate's binary value to be stored. |
Policy | policy | The policy about how to store a certificate securely. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Any of argument is null. |
System.ArgumentException | The alias argument is in the invalid format. cert argument is in the invalid format. |
System.InvalidOperationException | The certificate with alias already exist. |