jdk/src/java.base/share/classes/sun/security/x509/AVA.java
changeset 31426 9cd672654f97
parent 30649 e7cc8f48f616
child 31538 0981099a3e54
equal deleted inserted replaced
31425:276b895af81c 31426:9cd672654f97
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2015, 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
   362                     + "whitespace after terminating quote");
   362                     + "whitespace after terminating quote");
   363         }
   363         }
   364 
   364 
   365         // encode as PrintableString unless value contains
   365         // encode as PrintableString unless value contains
   366         // non-PrintableString chars
   366         // non-PrintableString chars
   367         if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
   367         if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
   368             (this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
   368             (this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
   369                 PRESERVE_OLD_DC_ENCODING == false)) {
   369                 PRESERVE_OLD_DC_ENCODING == false)) {
   370             // EmailAddress and DomainComponent must be IA5String
   370             // EmailAddress and DomainComponent must be IA5String
   371             return new DerValue(DerValue.tag_IA5String,
   371             return new DerValue(DerValue.tag_IA5String,
   372                                         temp.toString().trim());
   372                                         temp.toString().trim());
   373         } else if (isPrintableString) {
   373         } else if (isPrintableString) {
   493             embeddedHex.clear();
   493             embeddedHex.clear();
   494         }
   494         }
   495 
   495 
   496         // encode as PrintableString unless value contains
   496         // encode as PrintableString unless value contains
   497         // non-PrintableString chars
   497         // non-PrintableString chars
   498         if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
   498         if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
   499             (this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
   499             (this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
   500                 PRESERVE_OLD_DC_ENCODING == false)) {
   500                 PRESERVE_OLD_DC_ENCODING == false)) {
   501             // EmailAddress and DomainComponent must be IA5String
   501             // EmailAddress and DomainComponent must be IA5String
   502             return new DerValue(DerValue.tag_IA5String, temp.toString());
   502             return new DerValue(DerValue.tag_IA5String, temp.toString());
   503         } else if (isPrintableString) {
   503         } else if (isPrintableString) {
   504             return new DerValue(temp.toString());
   504             return new DerValue(temp.toString());