src/java.base/share/classes/java/security/spec/PSSParameterSpec.java
author jboes
Fri, 20 Sep 2019 11:07:52 +0100
changeset 58242 94bb65cb37d3
parent 53351 bdb29aa5fd31
permissions -rw-r--r--
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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
53351
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
     2
 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.security.spec;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    28
import java.util.Objects;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    31
 * This class specifies a parameter spec for RSASSA-PSS signature scheme,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * as defined in the
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    33
 * <a href="https://tools.ietf.org/rfc/rfc8017.txt">PKCS#1 v2.2</a> standard.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <p>Its ASN.1 definition in PKCS#1 standard is described below:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * RSASSA-PSS-params ::= SEQUENCE {
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    38
 *   hashAlgorithm      [0] HashAlgorithm      DEFAULT sha1,
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    39
 *   maskGenAlgorithm   [1] MaskGenAlgorithm   DEFAULT mgf1SHA1,
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    40
 *   saltLength         [2] INTEGER            DEFAULT 20,
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    41
 *   trailerField       [3] TrailerField       DEFAULT trailerFieldBC(1)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * where
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <pre>
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    46
 * HashAlgorithm ::= AlgorithmIdentifier {
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    47
 *   {OAEP-PSSDigestAlgorithms}
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    48
 * }
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    49
 * MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    50
 * TrailerField ::= INTEGER { trailerFieldBC(1) }
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    51
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    53
 *   { OID id-sha1       PARAMETERS NULL }|
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    54
 *   { OID id-sha224     PARAMETERS NULL }|
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    55
 *   { OID id-sha256     PARAMETERS NULL }|
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    56
 *   { OID id-sha384     PARAMETERS NULL }|
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    57
 *   { OID id-sha512     PARAMETERS NULL }|
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    58
 *   { OID id-sha512-224 PARAMETERS NULL }|
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    59
 *   { OID id-sha512-256 PARAMETERS NULL },
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *   ...  -- Allows for future expansion --
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    63
 *   { OID id-mgf1 PARAMETERS HashAlgorithm },
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *   ...  -- Allows for future expansion --
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <p>Note: the PSSParameterSpec.DEFAULT uses the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *     message digest  -- "SHA-1"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *     mask generation function (mgf) -- "MGF1"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *     parameters for mgf -- MGF1ParameterSpec.SHA1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *     SaltLength   -- 20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *     TrailerField -- 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * @see MGF1ParameterSpec
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * @see AlgorithmParameterSpec
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * @see java.security.Signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * @author Valerie Peng
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
public class PSSParameterSpec implements AlgorithmParameterSpec {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    86
    private final String mdName;
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    87
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    88
    private final String mgfName;
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    89
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    90
    private final AlgorithmParameterSpec mgfSpec;
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    91
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    92
    private final int saltLen;
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    93
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    94
    private final int trailerField;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /**
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    97
     * The {@code TrailerFieldBC} constant as defined in PKCS#1
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    98
     *
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
    99
     * @since 11
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   101
    public static final int TRAILER_FIELD_BC = 1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   104
     * The PSS parameter set with all default values
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   105
     *
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   106
     * @since 1.5
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   108
    public static final PSSParameterSpec DEFAULT = new PSSParameterSpec
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   109
        ("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, TRAILER_FIELD_BC);
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   110
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   111
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   112
    // disallowed
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    private PSSParameterSpec() {
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   114
        throw new RuntimeException("default constructor not allowed");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   117
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
18552
005e115dc6ee 8017326: Cleanup of the javadoc <code> tag in java.security.spec
juh
parents: 12685
diff changeset
   119
     * Creates a new {@code PSSParameterSpec} as defined in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * the PKCS #1 standard using the specified message digest,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * mask generation function, parameters for mask generation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * function, salt length, and trailer field values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   124
     * @param mdName       the algorithm name of the hash function
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   125
     * @param mgfName      the algorithm name of the mask generation function
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   126
     * @param mgfSpec      the parameters for the mask generation function.
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   127
     *         If null is specified, null will be returned by
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   128
     *         getMGFParameters().
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   129
     * @param saltLen      the length of salt
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   130
     * @param trailerField the value of the trailer field
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 53351
diff changeset
   131
     * @throws    NullPointerException if {@code mdName}, or {@code mgfName}
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   132
     *         is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 53351
diff changeset
   133
     * @throws    IllegalArgumentException if {@code saltLen} or
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   134
     *         {@code trailerField} is less than 0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public PSSParameterSpec(String mdName, String mgfName,
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   138
            AlgorithmParameterSpec mgfSpec, int saltLen, int trailerField) {
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   139
        Objects.requireNonNull(mdName, "digest algorithm is null");
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   140
        Objects.requireNonNull(mgfName,
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   141
            "mask generation function algorithm is null");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        if (saltLen < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            throw new IllegalArgumentException("negative saltLen value: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                                               saltLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (trailerField < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            throw new IllegalArgumentException("negative trailerField: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                                               trailerField);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        this.mdName = mdName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        this.mgfName = mgfName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        this.mgfSpec = mgfSpec;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        this.saltLen = saltLen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        this.trailerField = trailerField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
18552
005e115dc6ee 8017326: Cleanup of the javadoc <code> tag in java.security.spec
juh
parents: 12685
diff changeset
   158
     * Creates a new {@code PSSParameterSpec}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * using the specified salt length and other default values as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * defined in PKCS#1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   162
     * @param saltLen the length of salt in bytes to be used in PKCS#1
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   163
     *         PSS encoding
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 53351
diff changeset
   164
     * @throws    IllegalArgumentException if {@code saltLen} is
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   165
     *         less than 0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public PSSParameterSpec(int saltLen) {
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   168
        this("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, saltLen, TRAILER_FIELD_BC);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Returns the message digest algorithm name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   174
     * @return the message digest algorithm name
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    public String getDigestAlgorithm() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        return mdName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Returns the mask generation function algorithm name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   184
     * @return the mask generation function algorithm name
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    public String getMGFAlgorithm() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        return mgfName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * Returns the parameters for the mask generation function.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   195
     * @return the parameters for the mask generation function
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    public AlgorithmParameterSpec getMGFParameters() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        return mgfSpec;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /**
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   203
     * Returns the salt length in bytes.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   205
     * @return the salt length
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    public int getSaltLength() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        return saltLen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   212
     * Returns the value for the trailer field.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     *
50204
3195a713e24d 8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents: 47216
diff changeset
   214
     * @return the value for the trailer field
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    public int getTrailerField() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        return trailerField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
53351
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   220
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   221
    @Override
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   222
    public String toString() {
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   223
        StringBuilder sb = new StringBuilder();
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   224
        sb.append("MD: " + mdName + "\n")
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   225
                .append("MGF: " + mgfSpec + "\n")
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   226
                .append("SaltLength: " + saltLen + "\n")
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   227
                .append("TrailerField: " + trailerField + "\n");
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   228
        return sb.toString();
bdb29aa5fd31 8215694: keytool cannot generate RSASSA-PSS certificates
weijun
parents: 50204
diff changeset
   229
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
}