File: test_my_key.R

package info (click to toggle)
r-cran-openssl 1.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,136 kB
  • sloc: ansic: 2,033; sh: 19; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 411 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
context("Test default user key")

# Read secret key and public key

test_that("reading protected keys", {
  sk1 <- rsa_keygen()
  pk1 <- as.list(sk1)$pubkey
  tmp_key <- tempfile()
  tmp_pubkey <- tempfile()
  write_pem(sk1, tmp_key, password = NULL)
  write_pem(pk1, tmp_pubkey)

  # Test default private key
  Sys.setenv("USER_KEY" = tmp_key)
  expect_equal(sk1, my_key())
  expect_equal(pk1, my_pubkey())
})