[Top] [Prev] [Next]

certtostr, pktostr, sktostr, strtocert, strtopk, strtosk -encryption key conversion functions

include "keyring.m"
keyring:= load Keyring Keyring->PATH;
strtocert: fn(s: string)         : ref Certificate;
certtostr: fn(c: ref Certificate): string;
strtopk:   fn(s: string)         : ref PK;
pktostr:   fn(pk: ref PK)        : string;
strtosk:   fn(s: string)         : ref SK;
sktostr:   fn(sk: ref SK)        : string;


Certificates, public keys, and private keys are passed over networks and between applications using a Unicode representation. This collection of functions provide a means to convert adts supplied by the system to and from their portable textual representation. These routines are typically used as part of an I/O package for implementing security.

strtocert (s)

The strtocert function takes a string argument containing a user name, hash algorithm, a certifying authority and an expiration time. Fields are separated by a newline. The return value is a ref Certificate. If the string is of improper format, the result is nil.

certtostr (c)

The certtostr function performs the inverse operation of the strtocert function. It takes as an argument a ref Certificate and produces a text string suitable for communication over a network.

strtopk (s) and strtosk (pk)

The strtopk and strtosk functions take as their arguments a string representing the public and private key adts respectively. The string argument must contain an algorithm name, a user name and the key. Fields are separated by a newline. The result for strtopk is a ref PK and for strtosk a ref SK. If the string is of improper format the result is nil.

pktostr (pk) and sktostr (sk)

The pktostr and sktostr functions perform the inverse operations of the strtopk and strtosk functions, respectively.

They take a ref PK or ref SK and produce a text string.


The functions return the nil value if an error is encountered.

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.