< prev index next >

src/java.base/share/classes/sun/security/pkcs10/PKCS10.java

Print this page
rev 51972 : 8215694: keytool cannot generate RSASSA-PSS certificates
Reviewed-by: xuelei

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -30,11 +30,10 @@
 import java.io.IOException;
 import java.math.BigInteger;
 
 import java.security.cert.CertificateException;
 import java.security.*;
-import java.security.spec.AlgorithmParameterSpec;
 
 import java.util.Base64;
 
 import sun.security.util.*;
 import sun.security.x509.AlgorithmId;

@@ -235,14 +234,18 @@
         /*
          * Build guts of SIGNED macro
          */
         AlgorithmId algId = null;
         try {
-            algId = AlgorithmId.get(signature.getAlgorithm());
+            AlgorithmParameters params = signature.getParameters();
+            algId = params == null
+                    ? AlgorithmId.get(signature.getAlgorithm())
+                    : AlgorithmId.get(params);
         } catch (NoSuchAlgorithmException nsae) {
             throw new SignatureException(nsae);
         }
+
         algId.encode(scratch);     // sig algorithm
         scratch.putBitString(sig);                      // sig
 
         /*
          * Wrap those guts in a sequence
< prev index next >