src/java.base/share/classes/javax/crypto/spec/OAEPParameterSpec.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2018, 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
    30 import java.security.spec.MGF1ParameterSpec;
    30 import java.security.spec.MGF1ParameterSpec;
    31 
    31 
    32 /**
    32 /**
    33  * This class specifies the set of parameters used with OAEP Padding,
    33  * This class specifies the set of parameters used with OAEP Padding,
    34  * as defined in the
    34  * as defined in the
    35  * <a href="http://www.ietf.org/rfc/rfc3447.txt">PKCS #1</a>
    35  * <a href="https://tools.ietf.org/rfc/rfc8017.txt">PKCS#1 v2.2</a> standard.
    36  * standard.
       
    37  *
    36  *
    38  * Its ASN.1 definition in PKCS#1 standard is described below:
    37  * Its ASN.1 definition in PKCS#1 standard is described below:
    39  * <pre>
    38  * <pre>
    40  * RSAES-OAEP-params ::= SEQUENCE {
    39  * RSAES-OAEP-params ::= SEQUENCE {
    41  *   hashAlgorithm      [0] OAEP-PSSDigestAlgorithms     DEFAULT sha1,
    40  *   hashAlgorithm      [0] HashAlgorithm     DEFAULT sha1,
    42  *   maskGenAlgorithm   [1] PKCS1MGFAlgorithms  DEFAULT mgf1SHA1,
    41  *   maskGenAlgorithm   [1] MaskGenAlgorithm  DEFAULT mgf1SHA1,
    43  *   pSourceAlgorithm   [2] PKCS1PSourceAlgorithms  DEFAULT pSpecifiedEmpty
    42  *   pSourceAlgorithm   [2] PSourceAlgorithm  DEFAULT pSpecifiedEmpty
    44  * }
    43  * }
    45  * </pre>
    44  * </pre>
    46  * where
    45  * where
    47  * <pre>
    46  * <pre>
       
    47  * HashAlgorithm ::= AlgorithmIdentifier {
       
    48  *   {OAEP-PSSDigestAlgorithms}
       
    49  * }
       
    50  * MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
       
    51  * PSourceAlgorithm ::= AlgorithmIdentifier {
       
    52  *   {PKCS1PSourceAlgorithms}
       
    53  * }
       
    54  *
    48  * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
    55  * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
    49  *   { OID id-sha1 PARAMETERS NULL   }|
    56  *   { OID id-sha1       PARAMETERS NULL }|
    50  *   { OID id-sha256 PARAMETERS NULL }|
    57  *   { OID id-sha224     PARAMETERS NULL }|
    51  *   { OID id-sha384 PARAMETERS NULL }|
    58  *   { OID id-sha256     PARAMETERS NULL }|
    52  *   { OID id-sha512 PARAMETERS NULL },
    59  *   { OID id-sha384     PARAMETERS NULL }|
       
    60  *   { OID id-sha512     PARAMETERS NULL }|
       
    61  *   { OID id-sha512-224 PARAMETERS NULL }|
       
    62  *   { OID id-sha512-256 PARAMETERS NULL },
    53  *   ...  -- Allows for future expansion --
    63  *   ...  -- Allows for future expansion --
    54  * }
    64  * }
    55  * PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
    65  * PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
    56  *   { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
    66  *   { OID id-mgf1 PARAMETERS HashAlgorithm },
    57  *   ...  -- Allows for future expansion --
    67  *   ...  -- Allows for future expansion --
    58  * }
    68  * }
    59  * PKCS1PSourceAlgorithms    ALGORITHM-IDENTIFIER ::= {
    69  * PKCS1PSourceAlgorithms    ALGORITHM-IDENTIFIER ::= {
    60  *   { OID id-pSpecified PARAMETERS OCTET STRING },
    70  *   { OID id-pSpecified PARAMETERS EncodingParameters },
    61  *   ...  -- Allows for future expansion --
    71  *   ...  -- Allows for future expansion --
    62  * }
    72  * }
       
    73  * EncodingParameters ::= OCTET STRING(SIZE(0..MAX))
    63  * </pre>
    74  * </pre>
    64  * <p>Note: the OAEPParameterSpec.DEFAULT uses the following:
    75  * <p>Note: the OAEPParameterSpec.DEFAULT uses the following:
       
    76  * <pre>
    65  *     message digest  -- "SHA-1"
    77  *     message digest  -- "SHA-1"
    66  *     mask generation function (mgf) -- "MGF1"
    78  *     mask generation function (mgf) -- "MGF1"
    67  *     parameters for mgf -- MGF1ParameterSpec.SHA1
    79  *     parameters for mgf -- MGF1ParameterSpec.SHA1
    68  *     source of encoding input -- PSource.PSpecified.DEFAULT
    80  *     source of encoding input -- PSource.PSpecified.DEFAULT
       
    81  * </pre>
    69  *
    82  *
    70  * @see java.security.spec.MGF1ParameterSpec
    83  * @see java.security.spec.MGF1ParameterSpec
    71  * @see PSource
    84  * @see PSource
    72  *
    85  *
    73  * @author Valerie Peng
    86  * @author Valerie Peng