mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8146293: Add support for RSASSA-PSS Signature algorithm
Add RSASSA-PSS key and signature support to SunRsaSign provider Reviewed-by: wetmore
This commit is contained in:
parent
6216182dd1
commit
9e8d9fe1ee
79 changed files with 5489 additions and 627 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -321,11 +321,15 @@ public class Cipher {
|
|||
while (parser.hasMoreTokens() && count < 3) {
|
||||
parts[count++] = parser.nextToken().trim();
|
||||
}
|
||||
if (count == 0 || count == 2 || parser.hasMoreTokens()) {
|
||||
if (count == 0 || count == 2) {
|
||||
throw new NoSuchAlgorithmException("Invalid transformation"
|
||||
+ " format:" +
|
||||
transformation);
|
||||
}
|
||||
// treats all subsequent tokens as part of padding
|
||||
if (count == 3 && parser.hasMoreTokens()) {
|
||||
parts[2] = parts[2] + parser.nextToken("\r\n");
|
||||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
throw new NoSuchAlgorithmException("Invalid transformation " +
|
||||
"format:" + transformation);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -32,40 +32,53 @@ import java.security.spec.MGF1ParameterSpec;
|
|||
/**
|
||||
* This class specifies the set of parameters used with OAEP Padding,
|
||||
* as defined in the
|
||||
* <a href="http://www.ietf.org/rfc/rfc3447.txt">PKCS #1</a>
|
||||
* standard.
|
||||
* <a href="https://tools.ietf.org/rfc/rfc8017.txt">PKCS#1 v2.2</a> standard.
|
||||
*
|
||||
* Its ASN.1 definition in PKCS#1 standard is described below:
|
||||
* <pre>
|
||||
* RSAES-OAEP-params ::= SEQUENCE {
|
||||
* hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
|
||||
* maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
|
||||
* pSourceAlgorithm [2] PKCS1PSourceAlgorithms DEFAULT pSpecifiedEmpty
|
||||
* hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
|
||||
* maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
|
||||
* pSourceAlgorithm [2] PSourceAlgorithm DEFAULT pSpecifiedEmpty
|
||||
* }
|
||||
* </pre>
|
||||
* where
|
||||
* <pre>
|
||||
* HashAlgorithm ::= AlgorithmIdentifier {
|
||||
* {OAEP-PSSDigestAlgorithms}
|
||||
* }
|
||||
* MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
|
||||
* PSourceAlgorithm ::= AlgorithmIdentifier {
|
||||
* {PKCS1PSourceAlgorithms}
|
||||
* }
|
||||
*
|
||||
* OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-sha1 PARAMETERS NULL }|
|
||||
* { OID id-sha256 PARAMETERS NULL }|
|
||||
* { OID id-sha384 PARAMETERS NULL }|
|
||||
* { OID id-sha512 PARAMETERS NULL },
|
||||
* { OID id-sha1 PARAMETERS NULL }|
|
||||
* { OID id-sha224 PARAMETERS NULL }|
|
||||
* { OID id-sha256 PARAMETERS NULL }|
|
||||
* { OID id-sha384 PARAMETERS NULL }|
|
||||
* { OID id-sha512 PARAMETERS NULL }|
|
||||
* { OID id-sha512-224 PARAMETERS NULL }|
|
||||
* { OID id-sha512-256 PARAMETERS NULL },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
|
||||
* { OID id-mgf1 PARAMETERS HashAlgorithm },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* PKCS1PSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-pSpecified PARAMETERS OCTET STRING },
|
||||
* { OID id-pSpecified PARAMETERS EncodingParameters },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* EncodingParameters ::= OCTET STRING(SIZE(0..MAX))
|
||||
* </pre>
|
||||
* <p>Note: the OAEPParameterSpec.DEFAULT uses the following:
|
||||
* <pre>
|
||||
* message digest -- "SHA-1"
|
||||
* mask generation function (mgf) -- "MGF1"
|
||||
* parameters for mgf -- MGF1ParameterSpec.SHA1
|
||||
* source of encoding input -- PSource.PSpecified.DEFAULT
|
||||
* </pre>
|
||||
*
|
||||
* @see java.security.spec.MGF1ParameterSpec
|
||||
* @see PSource
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,13 +28,19 @@ package javax.crypto.spec;
|
|||
/**
|
||||
* This class specifies the source for encoding input P in OAEP Padding,
|
||||
* as defined in the
|
||||
* <a href="http://www.ietf.org/rfc/rfc3447.txt">PKCS #1</a>
|
||||
* standard.
|
||||
* <a href="https://tools.ietf.org/rfc/rfc8017.txt">PKCS#1 v2.2</a> standard.
|
||||
* <pre>
|
||||
* PSourceAlgorithm ::= AlgorithmIdentifier {
|
||||
* {PKCS1PSourceAlgorithms}
|
||||
* }
|
||||
* </pre>
|
||||
* where
|
||||
* <pre>
|
||||
* PKCS1PSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-pSpecified PARAMETERS OCTET STRING },
|
||||
* { OID id-pSpecified PARAMETERS EncodingParameters },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* EncodingParameters ::= OCTET STRING(SIZE(0..MAX))
|
||||
* </pre>
|
||||
* @author Valerie Peng
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -42,6 +42,7 @@
|
|||
*
|
||||
*
|
||||
* <ul>
|
||||
* <li>PKCS #1: RSA Cryptography Specifications, Version 2.2 (RFC 8017)</li>
|
||||
* <li>PKCS #3: Diffie-Hellman Key-Agreement Standard, Version 1.4,
|
||||
* November 1993.</li>
|
||||
* <li>PKCS #5: Password-Based Encryption Standard, Version 1.5,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue