< prev index next >

src/java.base/share/classes/java/security/spec/PSSParameterSpec.java

Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea


 111 
 112     // disallowed
 113     private PSSParameterSpec() {
 114         throw new RuntimeException("default constructor not allowed");
 115     }
 116 
 117 
 118     /**
 119      * Creates a new {@code PSSParameterSpec} as defined in
 120      * the PKCS #1 standard using the specified message digest,
 121      * mask generation function, parameters for mask generation
 122      * function, salt length, and trailer field values.
 123      *
 124      * @param mdName       the algorithm name of the hash function
 125      * @param mgfName      the algorithm name of the mask generation function
 126      * @param mgfSpec      the parameters for the mask generation function.
 127      *         If null is specified, null will be returned by
 128      *         getMGFParameters().
 129      * @param saltLen      the length of salt
 130      * @param trailerField the value of the trailer field
 131      * @exception NullPointerException if {@code mdName}, or {@code mgfName}
 132      *         is null
 133      * @exception IllegalArgumentException if {@code saltLen} or
 134      *         {@code trailerField} is less than 0
 135      * @since 1.5
 136      */
 137     public PSSParameterSpec(String mdName, String mgfName,
 138             AlgorithmParameterSpec mgfSpec, int saltLen, int trailerField) {
 139         Objects.requireNonNull(mdName, "digest algorithm is null");
 140         Objects.requireNonNull(mgfName,
 141             "mask generation function algorithm is null");
 142         if (saltLen < 0) {
 143             throw new IllegalArgumentException("negative saltLen value: " +
 144                                                saltLen);
 145         }
 146         if (trailerField < 0) {
 147             throw new IllegalArgumentException("negative trailerField: " +
 148                                                trailerField);
 149         }
 150         this.mdName = mdName;
 151         this.mgfName = mgfName;
 152         this.mgfSpec = mgfSpec;
 153         this.saltLen = saltLen;
 154         this.trailerField = trailerField;
 155     }
 156 
 157     /**
 158      * Creates a new {@code PSSParameterSpec}
 159      * using the specified salt length and other default values as
 160      * defined in PKCS#1.
 161      *
 162      * @param saltLen the length of salt in bytes to be used in PKCS#1
 163      *         PSS encoding
 164      * @exception IllegalArgumentException if {@code saltLen} is
 165      *         less than 0
 166      */
 167     public PSSParameterSpec(int saltLen) {
 168         this("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, saltLen, TRAILER_FIELD_BC);
 169     }
 170 
 171     /**
 172      * Returns the message digest algorithm name.
 173      *
 174      * @return the message digest algorithm name
 175      * @since 1.5
 176      */
 177     public String getDigestAlgorithm() {
 178         return mdName;
 179     }
 180 
 181     /**
 182      * Returns the mask generation function algorithm name.
 183      *
 184      * @return the mask generation function algorithm name




 111 
 112     // disallowed
 113     private PSSParameterSpec() {
 114         throw new RuntimeException("default constructor not allowed");
 115     }
 116 
 117 
 118     /**
 119      * Creates a new {@code PSSParameterSpec} as defined in
 120      * the PKCS #1 standard using the specified message digest,
 121      * mask generation function, parameters for mask generation
 122      * function, salt length, and trailer field values.
 123      *
 124      * @param mdName       the algorithm name of the hash function
 125      * @param mgfName      the algorithm name of the mask generation function
 126      * @param mgfSpec      the parameters for the mask generation function.
 127      *         If null is specified, null will be returned by
 128      *         getMGFParameters().
 129      * @param saltLen      the length of salt
 130      * @param trailerField the value of the trailer field
 131      * @throws    NullPointerException if {@code mdName}, or {@code mgfName}
 132      *         is null
 133      * @throws    IllegalArgumentException if {@code saltLen} or
 134      *         {@code trailerField} is less than 0
 135      * @since 1.5
 136      */
 137     public PSSParameterSpec(String mdName, String mgfName,
 138             AlgorithmParameterSpec mgfSpec, int saltLen, int trailerField) {
 139         Objects.requireNonNull(mdName, "digest algorithm is null");
 140         Objects.requireNonNull(mgfName,
 141             "mask generation function algorithm is null");
 142         if (saltLen < 0) {
 143             throw new IllegalArgumentException("negative saltLen value: " +
 144                                                saltLen);
 145         }
 146         if (trailerField < 0) {
 147             throw new IllegalArgumentException("negative trailerField: " +
 148                                                trailerField);
 149         }
 150         this.mdName = mdName;
 151         this.mgfName = mgfName;
 152         this.mgfSpec = mgfSpec;
 153         this.saltLen = saltLen;
 154         this.trailerField = trailerField;
 155     }
 156 
 157     /**
 158      * Creates a new {@code PSSParameterSpec}
 159      * using the specified salt length and other default values as
 160      * defined in PKCS#1.
 161      *
 162      * @param saltLen the length of salt in bytes to be used in PKCS#1
 163      *         PSS encoding
 164      * @throws    IllegalArgumentException if {@code saltLen} is
 165      *         less than 0
 166      */
 167     public PSSParameterSpec(int saltLen) {
 168         this("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, saltLen, TRAILER_FIELD_BC);
 169     }
 170 
 171     /**
 172      * Returns the message digest algorithm name.
 173      *
 174      * @return the message digest algorithm name
 175      * @since 1.5
 176      */
 177     public String getDigestAlgorithm() {
 178         return mdName;
 179     }
 180 
 181     /**
 182      * Returns the mask generation function algorithm name.
 183      *
 184      * @return the mask generation function algorithm name


< prev index next >