< prev index next >

test/sun/security/pkcs/pkcs9/UnknownAttribute.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8011867
  27  * @summary Accept unknown PKCS #9 attributes



  28  */
  29 
  30 import java.io.*;
  31 import java.util.Arrays;
  32 
  33 import sun.misc.HexDumpEncoder;
  34 import sun.security.pkcs.PKCS9Attribute;
  35 import sun.security.util.DerValue;
  36 import sun.security.util.ObjectIdentifier;
  37 
  38 public class UnknownAttribute {
  39 
  40     public static void main(String[] args) throws Exception {
  41         // Unknown attr
  42         PKCS9Attribute p1 = new PKCS9Attribute(
  43                 PKCS9Attribute.CHALLENGE_PASSWORD_STR, "t0p5ecr3t");
  44         if (!p1.isKnown()) {
  45             throw new Exception();
  46         }
  47         // Unknown attr from DER




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8011867
  27  * @summary Accept unknown PKCS #9 attributes
  28  * @modules java.base/sun.misc
  29  *          java.base/sun.security.pkcs
  30  *          java.base/sun.security.util
  31  */
  32 
  33 import java.io.*;
  34 import java.util.Arrays;
  35 
  36 import sun.misc.HexDumpEncoder;
  37 import sun.security.pkcs.PKCS9Attribute;
  38 import sun.security.util.DerValue;
  39 import sun.security.util.ObjectIdentifier;
  40 
  41 public class UnknownAttribute {
  42 
  43     public static void main(String[] args) throws Exception {
  44         // Unknown attr
  45         PKCS9Attribute p1 = new PKCS9Attribute(
  46                 PKCS9Attribute.CHALLENGE_PASSWORD_STR, "t0p5ecr3t");
  47         if (!p1.isKnown()) {
  48             throw new Exception();
  49         }
  50         // Unknown attr from DER


< prev index next >