Last data update: 2014.03.03

R: Public Key Instraftructure (X509) functions
X509R Documentation

Public Key Instraftructure (X509) functions

Description

PKI.load.cert creates a certificate obejct from a string, connection or file.

PKI.verifyCA verifies a certificate against a given chain of trust.

PKI.pubkey extracts public key from a certificate.

PKI.get.subject extracts the subject name from the certificate.

Usage

PKI.load.cert(what, format = c("PEM", "DER"), file)
PKI.verifyCA(certificate, ca)
PKI.pubkey(certificate)
PKI.get.subject(certificate)

Arguments

what

string, raw vector or connection to load the certificate from

format

format used to encode the certificate

file

filename to load the certificate from - what and file are mutually exclusive

certificate

a certificate object (as returned by PKI.load.cert)

ca

a certificate object of the Certificate Authority (CA) or a list of such objects if multiple CAs are involved

Value

PKI.load.code: a certificate object

PKI.verifyCA: TRUE is the certificate can be trusted, FALSE otherwise

PKI.pubkey: public key object

PKI.get.subject: string containing the subject information in one-line RFC2253 format but in UTF8 encoding instead of MBS escapes. NOTE: this is experimantal, we may choose to parse the contents and return it in native R form as a named vector instead.

Author(s)

Simon Urbanek

Examples

  ca <- PKI.load.cert(file=system.file("certs", "RForge-ca.crt", package="PKI"))
  my.cert <- PKI.load.cert(readLines(system.file("certs", "demo.crt", package="PKI")))
  PKI.verifyCA(my.cert, ca)
  PKI.pubkey(my.cert)
  PKI.get.subject(my.cert)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PKI)
Loading required package: base64enc
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PKI/X509.Rd_%03d_medium.png", width=480, height=480)
> ### Name: X509
> ### Title: Public Key Instraftructure (X509) functions
> ### Aliases: X509 PKI.load.cert PKI.verifyCA PKI.pubkey PKI.get.subject
> ### Keywords: manip
> 
> ### ** Examples
> 
>   ca <- PKI.load.cert(file=system.file("certs", "RForge-ca.crt", package="PKI"))
>   my.cert <- PKI.load.cert(readLines(system.file("certs", "demo.crt", package="PKI")))
>   PKI.verifyCA(my.cert, ca)
[1] FALSE
>   PKI.pubkey(my.cert)
<pointer: 0x31c4780>
attr(,"class")
[1] "public.key"
>   PKI.get.subject(my.cert)
[1] "C = US, ST = NJ, O = RForge.net, CN = Simon Urbanek, emailAddress = simon.urbanek@r-project.org"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>