AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
Certificate typedict
 
A Certificate is a Yoix implementation of a Java Certificate object. It is used for managing identity certificates. Identity certificates provide a means of vouching for the authenticity of the public key they contain. Currently, Yoix does not provide a means of creating new certificates, but rather only allows a Yoix user to load certificates already created and accessible from a file or URL. Yoix programs interact with certificates by reading, writing or executing the following Certificate fields:
keystring A read-only, hex-encoded, insecurely encrypted String representing the public key contained in the certificate and suitable for use by Cipher and other objects.
parameters A read-only Dictionary listing information about the certificate. The precise fields available in the dictionary differ based on the type of certificate, but there will always be a summary field that corresponds to Java's toString() output and summarizes the major features of the certificate.
source A field which specifies a Stream from which the certificate data should be loaded. Once the load is successful, which requires that the specification field has also been specified, this field returns an Array when read. The array contains int elements representing the byte encoding of the certificate (one integer element per byte).
specification When a String is assigned to this field, it indicates the certificate type (e.g., X.509). When a Dictionary is assigned to this field, it should have a String field called type and, optionally, a String field called provider, which indicates which provider of the certificate's type implementation should be used.
verify(String keystring) A Builtin that checks whether the public key provided as an argument and in the format of a Yoix keystring, described elsewhere, corresponds to the private key that was used to sign this certificate. If it does, a non-zero int value is returned, otherwise zero is returned.
Several permanent fields have not been documented and should not be used in Yoix applications.

 
 Example:   The program,
import yoix.*.*;

String fullpath = yoixPath(argv[0]);
int last = lastIndexOf(fullpath, '/');

String certfile = "Data/dukecertfile.cer";
String certpath = substring(fullpath, 0, last+1) + certfile;

File fl;
Certificate cert;

cert.specification = "X509";
fl = fopen(certpath, "r");
cert.source = fl;

fprintf(stdout, "Keystring:\n%s\n", cert.keystring);
fprintf(stdout, "\n");
fprintf(stdout, "Source:\n%s\n", btoh(cert.source));
fprintf(stdout, "\n");
fprintf(stdout, "Summary:\n%s\n", cert.parameters.summary);

loads a certificate from a file and displays some information about it.
 
 See Also:   adjustSecurity, getCertificates, Cipher, Key, KeyStore, Random

 

Yoix is a registered trademark of AT&T Inc.