Class CertificateManager

Definition

Namespace:
Tizen.Security.SecureRepository
Assembly:
Tizen.Security.SecureRepository.dll

Provides methods that handle certificates.

C#
Copy
public class CertificateManager : Manager
Inheritance
object
CertificateManager

Methods

View Source

CheckOcsp(IEnumerable<Certificate>)

[Obsolete("Please do not use! this will be deprecated")]

Declaration
C#
Copy
[Obsolete("Please do not use! This will be deprecated with API9 and removed with API11! Please use raw OpenSSL instead!")] 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

Status result of the OCSP check.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when certificateChain argument is null.

System.ArgumentException

Thrown when certificateChain is not a valid chain or certificate.

System.InvalidOperationException

Thrown when any of the certificates in chain is expired or not valid yet.

View Source

Get(string, string)

Gets a certificate from the secure repository.

Declaration
C#
Copy
public static Certificate Get(string alias, string password)
Parameters
Type Name Description
string alias

Name of a certificate to be retrieved.

string password

Password used in decrypting a certificate value.

Returns
Type Description
Certificate

Certificate specified by alias.

Remarks

If password of policy is provided in SaveCertificate(), the same password should be provided.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when alias argument is null.

System.ArgumentException

Thrown when alias argument has an invalid format.

System.InvalidOperationException

Thrown when a certificate does not exist with the alias or certificate-protecting password does not match.

View Source

GetAliases()

Gets all aliases of certificates accessible by the client.

Declaration
C#
Copy
public static IEnumerable<string> GetAliases()
Returns
Type Description
System.Collections.Generic.IEnumerable<T><string>

All aliases of certificates accessible by the client.

Exceptions
Type Condition
System.ArgumentException

Thrown when there's no alias to get.

View Source

GetCertificateChain(Certificate, IEnumerable<Certificate>, IEnumerable<Certificate>, bool)

Verifies a certificate chain and returns that chain using user entered trusted and untrusted CA certificates.

Declaration
C#
Copy
public static IEnumerable<Certificate> GetCertificateChain(Certificate certificate, IEnumerable<Certificate> untrustedCertificates, IEnumerable<Certificate> trustedCertificates, bool useTrustedSystemCertificates)
Parameters
Type Name Description
Certificate certificate

Certificate to be verified.

System.Collections.Generic.IEnumerable<T><Certificate> untrustedCertificates

Untrusted CA certificates to be used in verifying a certificate chain.

System.Collections.Generic.IEnumerable<T><Certificate> trustedCertificates

Trusted CA certificates to be used in verifying a certificate chain.

bool useTrustedSystemCertificates

Flag indicating the use of the trusted root certificates in the system's certificate storage.

Returns
Type Description
System.Collections.Generic.IEnumerable<T><Certificate>

Newly created certificate chain.

Remarks

Trusted root certificate of the chain in the system's certificate storage is added to the certificate chain.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when certificate argument is null.

System.ArgumentException

Thrown when any of the provided certificates is invalid.

System.InvalidOperationException

Thrown when any of the provided certificates is expired or not valid yet. Thrown when certificate cannot build a chain. Thrown when root certificate is not in the trusted system certificate store.

View Source

GetCertificateChain(Certificate, IEnumerable<Certificate>)

Verifies a certificate chain and returns that chain.

Declaration
C#
Copy
public static IEnumerable<Certificate> GetCertificateChain(Certificate certificate, IEnumerable<Certificate> untrustedCertificates)
Parameters
Type Name Description
Certificate certificate

Certificate to be verified.

System.Collections.Generic.IEnumerable<T><Certificate> untrustedCertificates

Untrusted CA certificates to be used in verifying a certificate chain.

Returns
Type Description
System.Collections.Generic.IEnumerable<T><Certificate>

Newly created certificate chain.

Remarks

Trusted root certificate of the chain should exist in the system's certificate storage.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when a certificate argument is null.

System.ArgumentException

Thrown when any of the provided certificates is invalid.

System.InvalidOperationException

Thrown when any of the provided certificates is expired or not valid yet. Thrown when certificate cannot build a chain. Thrown when root certificate is not in the trusted system certificate store.

View Source

Save(string, Certificate, Policy)

Stores a certificate inside the secure repository based on the provided policy.

Declaration
C#
Copy
public static void Save(string alias, Certificate cert, Policy policy)
Parameters
Type Name Description
string alias

Name of a certificate to be stored.

Certificate cert

Certificate's binary value to be stored.

Policy policy

Certificate storing policy.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when any argument is null.

System.ArgumentException

Thrown when alias or cert argument has an invalid format.

System.InvalidOperationException

Thrown when a certificate with given alias already exists.