jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
changeset 18552 005e115dc6ee
parent 12685 8a448b5b9006
equal deleted inserted replaced
18551:882a3948c6e6 18552:005e115dc6ee
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2013, 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
    89      * @since 1.5
    89      * @since 1.5
    90      */
    90      */
    91     public static final PSSParameterSpec DEFAULT = new PSSParameterSpec();
    91     public static final PSSParameterSpec DEFAULT = new PSSParameterSpec();
    92 
    92 
    93     /**
    93     /**
    94      * Constructs a new <code>PSSParameterSpec</code> as defined in
    94      * Constructs a new {@code PSSParameterSpec} as defined in
    95      * the PKCS #1 standard using the default values.
    95      * the PKCS #1 standard using the default values.
    96      */
    96      */
    97     private PSSParameterSpec() {
    97     private PSSParameterSpec() {
    98     }
    98     }
    99 
    99 
   100     /**
   100     /**
   101      * Creates a new <code>PSSParameterSpec</code> as defined in
   101      * Creates a new {@code PSSParameterSpec} as defined in
   102      * the PKCS #1 standard using the specified message digest,
   102      * the PKCS #1 standard using the specified message digest,
   103      * mask generation function, parameters for mask generation
   103      * mask generation function, parameters for mask generation
   104      * function, salt length, and trailer field values.
   104      * function, salt length, and trailer field values.
   105      *
   105      *
   106      * @param mdName the algorithm name of the hash function.
   106      * @param mdName the algorithm name of the hash function.
   109      * @param mgfSpec the parameters for the mask generation
   109      * @param mgfSpec the parameters for the mask generation
   110      * function. If null is specified, null will be returned by
   110      * function. If null is specified, null will be returned by
   111      * getMGFParameters().
   111      * getMGFParameters().
   112      * @param saltLen the length of salt.
   112      * @param saltLen the length of salt.
   113      * @param trailerField the value of the trailer field.
   113      * @param trailerField the value of the trailer field.
   114      * @exception NullPointerException if <code>mdName</code>,
   114      * @exception NullPointerException if {@code mdName},
   115      * or <code>mgfName</code> is null.
   115      * or {@code mgfName} is null.
   116      * @exception IllegalArgumentException if <code>saltLen</code>
   116      * @exception IllegalArgumentException if {@code saltLen}
   117      * or <code>trailerField</code> is less than 0.
   117      * or {@code trailerField} is less than 0.
   118      * @since 1.5
   118      * @since 1.5
   119      */
   119      */
   120     public PSSParameterSpec(String mdName, String mgfName,
   120     public PSSParameterSpec(String mdName, String mgfName,
   121                             AlgorithmParameterSpec mgfSpec,
   121                             AlgorithmParameterSpec mgfSpec,
   122                             int saltLen, int trailerField) {
   122                             int saltLen, int trailerField) {
   141         this.saltLen = saltLen;
   141         this.saltLen = saltLen;
   142         this.trailerField = trailerField;
   142         this.trailerField = trailerField;
   143     }
   143     }
   144 
   144 
   145     /**
   145     /**
   146      * Creates a new <code>PSSParameterSpec</code>
   146      * Creates a new {@code PSSParameterSpec}
   147      * using the specified salt length and other default values as
   147      * using the specified salt length and other default values as
   148      * defined in PKCS#1.
   148      * defined in PKCS#1.
   149      *
   149      *
   150      * @param saltLen the length of salt in bits to be used in PKCS#1
   150      * @param saltLen the length of salt in bits to be used in PKCS#1
   151      * PSS encoding.
   151      * PSS encoding.
   152      * @exception IllegalArgumentException if <code>saltLen</code> is
   152      * @exception IllegalArgumentException if {@code saltLen} is
   153      * less than 0.
   153      * less than 0.
   154      */
   154      */
   155     public PSSParameterSpec(int saltLen) {
   155     public PSSParameterSpec(int saltLen) {
   156         if (saltLen < 0) {
   156         if (saltLen < 0) {
   157             throw new IllegalArgumentException("negative saltLen value: " +
   157             throw new IllegalArgumentException("negative saltLen value: " +