public static Anchor[] GetOutgoingAnchors(this AnchorStoreClient client, string owner, EntityStatus status) { CertificateGetOptions options = CertificateExtensions.FullCertData.Clone(); options.Status = status; return(client.GetOutgoingAnchors(owner, options)); }
public static Certificate[] GetCertificatesForOwner(this CertificateStoreClient client, string owner, EntityStatus status) { CertificateGetOptions options = FullCertData.Clone(); options.Status = status; return(client.GetCertificatesForOwner(owner, options)); }
public void CertificateByIDGet(string[] args) { long certificateID = args.GetRequiredValue <int>(0); CertificateGetOptions options = new CertificateGetOptions() { IncludeData = args.GetOptionalValue(1, false), IncludePrivateKey = args.GetOptionalValue(2, false) }; string outputFile = args.GetOptionalValue(3, string.Empty); Certificate certificate = Client.GetCertificate(certificateID, options); this.Print(certificate); if (certificate == null) { return; } if (!string.IsNullOrEmpty(outputFile) && certificate.HasData) { File.WriteAllBytes(outputFile, certificate.Data); } }
public void AnchorByIDGet(string[] args) { long anchorID = args.GetRequiredValue <int>(0); CertificateGetOptions options = new CertificateGetOptions() { IncludeData = args.GetOptionalValue(1, false), IncludePrivateKey = args.GetOptionalValue(2, false) }; string outputFile = args.GetOptionalValue(3, string.Empty); Anchor[] anchors = Client.GetAnchors(new[] { anchorID }, options); this.Print(anchors); if (anchors.Length < 1) { return; } Anchor anchor = anchors[0]; if (!string.IsNullOrEmpty(outputFile) && anchor.HasData) { File.WriteAllBytes(outputFile, anchor.Data); } }
public void AnchorsGet(string[] args) { string owner = args.GetRequiredValue(0); CertificateGetOptions options = this.CertCommands.GetOptions(args, 1); Anchor[] anchors = Client.GetAnchorsForOwner(owner, options); this.Print(anchors); }
public static CertificateGetOptions Clone(this CertificateGetOptions options) { return(new CertificateGetOptions { IncludeData = options.IncludeData, IncludePrivateKey = options.IncludePrivateKey, Status = options.Status }); }
public void CertificateGet(string[] args) { string owner = args.GetRequiredValue(0); CertificateGetOptions options = GetOptions(args, 1); Certificate[] certs = Client.GetCertificatesForOwner(owner, options); this.Print(certs); }
void Search(Func <X509Certificate2, bool> filter) { CertificateGetOptions getOptions = new CertificateGetOptions() { IncludeData = true, IncludePrivateKey = false }; Search(Client.EnumerateCertificates(25, getOptions), filter); }
public void AnchorsList(string[] args) { CertificateGetOptions options = this.CertCommands.GetOptions(args, 0); foreach (Anchor anchor in Client.EnumerateAnchors(10, options)) { this.Print(anchor); CommandUI.PrintSectionBreak(); } }
public static Certificate GetCertificate(this CertificateStoreClient client, long certificateID, CertificateGetOptions options) { Certificate[] certs = client.GetCertificates(new long[] {certificateID}, options); if (certs.IsNullOrEmpty()) { return null; } return certs[0]; }
public void CertificateExportAll(string[] args) { string outputFile = args.GetOptionalValue(0, null); int chunkSize = args.GetOptionalValue(1, 25); CertificateGetOptions options = new CertificateGetOptions { IncludeData = true, IncludePrivateKey = false }; IEnumerable <Certificate> certs = Client.EnumerateCertificates(chunkSize, options); ExportCerts(certs, outputFile); }
public void CertificateResolve(string[] args) { MailAddress owner = new MailAddress(args.GetRequiredValue(0)); CertificateGetOptions options = GetOptions(args, 1); options.Status = EntityStatus.Enabled; // We only ever resolve Enabled Certs Certificate[] certs = Client.GetCertificatesForOwner(owner.Address, options); if (certs.IsNullOrEmpty()) { certs = Client.GetCertificatesForOwner(owner.Host, options); } this.Print(certs); }
public void AnchorResolve(string[] args) { MailAddress owner = new MailAddress(args.GetRequiredValue(0)); CertificateGetOptions options = this.CertCommands.GetOptions(args, 1); options.Status = EntityStatus.Enabled; // We only ever resolve Enabled Anchors Anchor[] anchors = Client.GetAnchorsForOwner(owner.Address, options); if (anchors.IsNullOrEmpty()) { anchors = Client.GetAnchorsForOwner(owner.Host, options); } this.Print(anchors); }
public IEnumerable<Certificate> Resolve(string owner, bool showData) { MailAddress address = new MailAddress(owner); var options = new CertificateGetOptions { IncludeData = showData }; Certificate[] certs = Client.GetCertificatesForOwner(address.Address, options); if (certs.IsNullOrEmpty()) { certs = Client.GetCertificatesForOwner(address.Host, options); } return certs; }
internal CertificateGetOptions GetOptions(string[] args, int firstArg) { CertificateGetOptions options = new CertificateGetOptions { IncludeData = args.GetOptionalValue(firstArg, false), IncludePrivateKey = args.GetOptionalValue(firstArg + 1, false) }; if (args.GetValueOrNull(firstArg + 2) != null) { options.Status = args.GetRequiredEnum <EntityStatus>(firstArg + 2); } return(options); }
public void CertificateListAll(string[] args) { string outputFile = args.GetOptionalValue(0, null); int chunkSize = args.GetOptionalValue(1, 25); CertificateGetOptions options = new CertificateGetOptions { IncludeData = true, IncludePrivateKey = false }; IEnumerable <Certificate> certs = Client.EnumerateCertificates(chunkSize, options); foreach (Certificate cert in certs) { this.Print(cert); CommandUI.PrintSectionBreak(); } }
public IEnumerable <Certificate> Resolve(string owner, bool showData) { MailAddress address = new MailAddress(owner); var options = new CertificateGetOptions { IncludeData = showData }; Certificate[] certs = Client.GetCertificatesForOwner(address.Address, options); if (certs.IsNullOrEmpty()) { certs = Client.GetCertificatesForOwner(address.Host, options); } return(certs); }
public void CertificateExport(string[] args) { string owner = args.GetRequiredValue(0); string outputFile = args.GetOptionalValue(1, null); CertificateGetOptions options = new CertificateGetOptions { IncludeData = true, IncludePrivateKey = false }; Certificate[] certs = Client.GetCertificatesForOwner(owner, options); if (certs.IsNullOrEmpty()) { WriteLine("No certificates found"); return; } ExportCerts(certs, outputFile); }
public static Certificate GetCertificate(this CertificateStoreClient client, long certificateID, CertificateGetOptions options) { Certificate[] certs = client.GetCertificates(new long[] { certificateID }, options); if (certs.IsNullOrEmpty()) { return(null); } return(certs[0]); }
public static IEnumerable <Anchor> EnumerateAnchors(this AnchorStoreClient client, int chunkSize, CertificateGetOptions options) { if (options == null) { throw new ArgumentNullException("options"); } if (chunkSize < 1) { throw new ArgumentException("value was less than 1", "chunkSize"); } long lastID = -1; Anchor[] anchors; while (true) { anchors = client.EnumerateAnchors(lastID, chunkSize, options); if (anchors == null || anchors.Length == 0) { yield break; } for (int i = 0; i < anchors.Length; ++i) { yield return(anchors[i]); } lastID = anchors[anchors.Length - 1].ID; } }
public static IEnumerable<Certificate> EnumerateCertificates(this CertificateStoreClient client, int chunkSize, CertificateGetOptions options) { if (options == null) { throw new ArgumentNullException("options"); } if (chunkSize < 1) { throw new ArgumentException("value was less than 1", "chunkSize"); } long lastID = -1; Certificate[] certs; while (true) { certs = client.EnumerateCertificates(lastID, chunkSize, options); if (certs.IsNullOrEmpty()) { yield break; } for (int i = 0; i < certs.Length; ++i) { yield return certs[i]; } lastID = certs[certs.Length - 1].ID; } }
public static IEnumerable<Anchor> EnumerateAnchors(this AnchorStoreClient client, int chunkSize, CertificateGetOptions options) { if (options == null) { throw new ArgumentNullException("options"); } if (chunkSize < 1) { throw new ArgumentException("value was less than 1", "chunkSize"); } long lastID = -1; Anchor[] anchors; while (true) { anchors = client.EnumerateAnchors(lastID, chunkSize, options); if (anchors == null || anchors.Length == 0) { yield break; } for (int i = 0; i < anchors.Length; ++i) { yield return anchors[i]; } lastID = anchors[anchors.Length - 1].ID; } }
public virtual async Task <Response <Certificate> > GetAsync(string thumbprintAlgorithm, string thumbprint, CertificateGetOptions certificateGetOptions, CancellationToken cancellationToken = default) { return(await RestClient.GetAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Gets information about the specified Certificate. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='thumbprintAlgorithm'> /// The algorithm used to derive the thumbprint parameter. This must be sha1. /// </param> /// <param name='thumbprint'> /// The thumbprint of the Certificate to get. /// </param> /// <param name='certificateGetOptions'> /// Additional parameters for the operation /// </param> public static Certificate Get(this ICertificateOperations operations, string thumbprintAlgorithm, string thumbprint, CertificateGetOptions certificateGetOptions = default(CertificateGetOptions)) { return(operations.GetAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions).GetAwaiter().GetResult()); }
public static IEnumerable <Certificate> EnumerateCertificates(this CertificateStoreClient client, int chunkSize, CertificateGetOptions options) { if (options == null) { throw new ArgumentNullException("options"); } if (chunkSize < 1) { throw new ArgumentException("value was less than 1", "chunkSize"); } long lastID = -1; Certificate[] certs; while (true) { certs = client.EnumerateCertificates(lastID, chunkSize, options); if (certs.IsNullOrEmpty()) { yield break; } for (int i = 0; i < certs.Length; ++i) { yield return(certs[i]); } lastID = certs[certs.Length - 1].ID; } }
/// <summary> /// Gets information about the specified certificate. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='thumbprintAlgorithm'> /// The algorithm used to derive the thumbprint parameter. This must be sha1. /// </param> /// <param name='thumbprint'> /// The thumbprint of the certificate to get. /// </param> /// <param name='certificateGetOptions'> /// Additional parameters for the operation /// </param> public static Certificate Get(this ICertificateOperations operations, string thumbprintAlgorithm, string thumbprint, CertificateGetOptions certificateGetOptions = default(CertificateGetOptions)) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((ICertificateOperations)s).GetAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Gets information about the specified Certificate. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='thumbprintAlgorithm'> /// The algorithm used to derive the thumbprint parameter. This must be sha1. /// </param> /// <param name='thumbprint'> /// The thumbprint of the Certificate to get. /// </param> /// <param name='certificateGetOptions'> /// Additional parameters for the operation /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Certificate> GetAsync(this ICertificateOperations operations, string thumbprintAlgorithm, string thumbprint, CertificateGetOptions certificateGetOptions = default(CertificateGetOptions), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public virtual Response <Certificate> Get(string thumbprintAlgorithm, string thumbprint, CertificateGetOptions certificateGetOptions, CancellationToken cancellationToken = default) { return(RestClient.Get(thumbprintAlgorithm, thumbprint, certificateGetOptions, cancellationToken)); }