src/java.security.jgss/share/classes/sun/security/krb5/internal/util/KerberosString.java
changeset 49555 12fe57c319e1
parent 47216 71c04702a3d5
child 51398 3c389a284345
equal deleted inserted replaced
49554:f088ec60bed5 49555:12fe57c319e1
     1 /*
     1 /*
     2  * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    24  */
    24  */
    25 
    25 
    26 package sun.security.krb5.internal.util;
    26 package sun.security.krb5.internal.util;
    27 
    27 
    28 import java.io.IOException;
    28 import java.io.IOException;
    29 import java.security.AccessController;
    29 import sun.security.action.GetPropertyAction;
    30 import sun.security.action.GetBooleanAction;
       
    31 import sun.security.util.DerValue;
    30 import sun.security.util.DerValue;
    32 
    31 
    33 /**
    32 /**
    34  * Implements the ASN.1 KerberosString type.
    33  * Implements the ASN.1 KerberosString type.
    35  *
    34  *
    43  * http://www.ietf.org/rfc/rfc4120.txt</a>.
    42  * http://www.ietf.org/rfc/rfc4120.txt</a>.
    44  */
    43  */
    45 public final class KerberosString {
    44 public final class KerberosString {
    46     /**
    45     /**
    47      * RFC 4120 defines KerberosString as GeneralString (IA5String), which
    46      * RFC 4120 defines KerberosString as GeneralString (IA5String), which
    48      * only includes ASCII characters. However, other implementations have been
    47      * only includes ASCII characters. However, most implementations have been
    49      * known to use GeneralString to contain UTF-8 encoding. To interop
    48      * known to use GeneralString to contain UTF-8 encoding. The following
    50      * with these implementations, the following system property is defined.
    49      * system property is defined. When set as true, KerberosString is encoded
    51      * When set as true, KerberosString is encoded as UTF-8. Note that this
    50      * as UTF-8. Otherwise, it's ASCII. The default is true.
    52      * only affects the byte encoding, the tag of the ASN.1 type is still
    51      *
    53      * GeneralString.
    52      * Note that this only affects the byte encoding, the tag of the ASN.1
       
    53      * type is still GeneralString.
    54      */
    54      */
    55     public static final boolean MSNAME = AccessController.doPrivileged(
    55     public static final boolean MSNAME;
    56             new GetBooleanAction("sun.security.krb5.msinterop.kstring"));
    56 
       
    57     static {
       
    58         String prop = GetPropertyAction.privilegedGetProperty(
       
    59                 "sun.security.krb5.msinterop.kstring", "true");
       
    60         MSNAME = Boolean.parseBoolean(prop);
       
    61     }
    57 
    62 
    58     private final String s;
    63     private final String s;
    59 
    64 
    60     public KerberosString(String s) {
    65     public KerberosString(String s) {
    61         this.s = s;
    66         this.s = s;