Class X509CertificateUtility
Supporting class for certificate based operations
Inheritance
System.Object
X509CertificateUtility
Namespace: PnP.Framework.Utilities
Assembly: PnP.Framework.dll
Syntax
public static class X509CertificateUtility : object
Methods
Decrypt(Byte[], Boolean, X509Certificate2)
Decrypts data based on the RSACryptoServiceProvider
Declaration
public static byte[] Decrypt(byte[] encryptedData, bool fOAEP, X509Certificate2 certificate)
Parameters
System.Byte[]
encryptedData
Bytes to decrypt |
System.Boolean
fOAEP
true to perform direct System.Security.Cryptography.RSA decryption using OAEP padding |
X509Certificate2
certificate
Certificate to use |
Returns
System.Byte[]
Decrypted bytes |
Encrypt(Byte[], Boolean, X509Certificate2)
Encrypts data based on the RSACryptoServiceProvider
Declaration
public static byte[] Encrypt(byte[] plainData, bool fOAEP, X509Certificate2 certificate)
Parameters
System.Byte[]
plainData
Bytes to encrypt |
System.Boolean
fOAEP
true to perform direct System.Security.Cryptography.RSA decryption using OAEP padding |
X509Certificate2
certificate
Certificate to use |
Returns
System.Byte[]
Encrypted bytes |
GetPublicKey(X509Certificate2)
Returns the certificate public key
Declaration
public static string GetPublicKey(X509Certificate2 certificate)
Parameters
X509Certificate2
certificate
Certificate to operate on |
Returns
System.String
Public key of the certificate |
LoadCertificate(StoreName, StoreLocation, String)
Loads a certificate from a given certificate store
Declaration
public static X509Certificate2 LoadCertificate(StoreName storeName, StoreLocation storeLocation, string thumbprint)
Parameters
StoreName
storeName
Name of the certificate store |
StoreLocation
storeLocation
Location of the certificate store |
System.String
thumbprint
Thumbprint of the certificate to load |
Returns
X509Certificate2
An |