Example usage for org.bouncycastle.asn1 BERTags UTF8_STRING

List of usage examples for org.bouncycastle.asn1 BERTags UTF8_STRING

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 BERTags UTF8_STRING.

Prototype

int UTF8_STRING

To view the source code for org.bouncycastle.asn1 BERTags UTF8_STRING.

Click Source Link

Usage

From source file:org.jruby.ext.openssl.X509Name.java

License:LGPL

public static void createX509Name(Ruby runtime, RubyModule mX509) {
    RubyClass cX509Name = mX509.defineClassUnder("Name", runtime.getObject(), X509NAME_ALLOCATOR);
    RubyClass openSSLError = runtime.getModule("OpenSSL").getClass("OpenSSLError");
    mX509.defineClassUnder("NameError", openSSLError, openSSLError.getAllocator());

    cX509Name.defineAnnotatedMethods(X509Name.class);

    cX509Name.setConstant("COMPAT", runtime.newFixnum(COMPAT));
    cX509Name.setConstant("RFC2253", runtime.newFixnum(RFC2253));
    cX509Name.setConstant("ONELINE", runtime.newFixnum(ONELINE));
    cX509Name.setConstant("MULTILINE", runtime.newFixnum(MULTILINE));

    cX509Name.setConstant("DEFAULT_OBJECT_TYPE", runtime.newFixnum(BERTags.UTF8_STRING));

    RubyHash hash = new RubyHash(runtime, runtime.newFixnum(BERTags.UTF8_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("C"),
            runtime.newFixnum(BERTags.PRINTABLE_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("countryName"),
            runtime.newFixnum(BERTags.PRINTABLE_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("serialNumber"),
            runtime.newFixnum(BERTags.PRINTABLE_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("dnQualifier"),
            runtime.newFixnum(BERTags.PRINTABLE_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("DC"), runtime.newFixnum(BERTags.IA5_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("domainComponent"),
            runtime.newFixnum(BERTags.IA5_STRING));
    hash.op_aset(runtime.getCurrentContext(), runtime.newString("emailAddress"),
            runtime.newFixnum(BERTags.IA5_STRING));
    cX509Name.setConstant("OBJECT_TYPE_TEMPLATE", hash);

    cX509Name.includeModule(runtime.getComparable());
}