Code Monkey home page Code Monkey logo

certificate-checker-package's Introduction

certificate-checker

Overview

certificate-checker will allow you to view certificate details

Usage

    //Create certificate from URL (WEB or local file)
    var certificate = CertificateParserViewController(url: URL(string: "apple.com")!)

    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.addSubview(certificate.view)
    }

Enjoy!

certificate-checker-package's People

Contributors

mrdizlike avatar ayuzhin avatar

Watchers

 avatar  avatar

Forkers

ayuzhin

certificate-checker-package's Issues

Use contentView.layoutMarginsGuide

NSLayoutConstraint.activate([
titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 15),
titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 5),
infoLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -15),
infoLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0)
])
// Constraints для side-by-side расположения
sideBySideConstraints = [
titleLabel.trailingAnchor.constraint(lessThanOrEqualTo: infoLabel.leadingAnchor, constant: -10),
titleLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -5),
infoLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 5)
]
// Constraints для stacked расположения
stackedConstraints = [
infoLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 15),
infoLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 5),
infoLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -15),
infoLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -5)

It is worth placing margins considering the standard margins of the cell content.

Localization capability

alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.viewController.present(alert, animated: true, completion: nil)

if years != 0 {
return "\(years) years \(months) months \(days) days"
} else if months != 0{
return "\(months) months \(days) days"
} else {
return "\(days)"
}

func setupViewController() {
title = certificate?.subjectCN
sections = [
Section(title: "SUBJECT", rows: [
Row(title: "Common Name", value: certificate?.subjectCN),
Row(title: "Country", value: certificate?.subjectC),
Row(title: "Organization", value: certificate?.subjectO),
Row(title: "State", value: certificate?.subjectL),
Row(title: "Organizational Unit", value: certificate?.subjectOU)
]),
Section(title: "ISSUER", rows: [
Row(title: "Common Name", value: certificate?.issuerCN),
Row(title: "Country", value: certificate?.issuerC),
Row(title: "Organization", value: certificate?.issuerO),
Row(title: "Organizational Unit", value: certificate?.issuerOU)
]),
Section(title: "VALIDITY PERIOD", rows: [
Row(title: "Validity Before", value: "\(certificate!.validityBefore)"),
Row(title: "Validity After", value: "\(certificate!.validityAfter)"),
Row(title: "Valid For", value: "\(certificate!.validFor)"),
Row(title: "Will Expire In", value: "\(certificate!.willExpireIn)")
]),
Section(title: "KEY USAGE", rows: [
Row(title: "Basic", value: certificate?.keyUsageBasic),
Row(title: "Extended", value: certificate?.keyUsageExtended)
]),
Section(title: "PUBLIC KEY", rows: [
Row(title: "Signature Algorithm", value: certificate?.signatureAlgorithm),
Row(title: "Signature", value: certificate?.signature)
]),
Section(title: "KEY IDENTIFIER", rows: [
Row(title: "Subject", value: certificate?.subjectKeyId),
Row(title: "Authority", value: certificate?.authorityKeyId)
]),
Section(title: "METADATA", rows: [
Row(title: "Serial Number", value: certificate?.serialNumber),
Row(title: "Certificate Authority", value: certificate?.certificateAuthority),
Row(title: "Version", value: certificate?.version)
])
]

Add localization capability in the client application.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.