--- a/src/java.base/share/classes/sun/security/pkcs10/PKCS10.java Fri Dec 07 16:56:53 2018 -0800
+++ b/src/java.base/share/classes/sun/security/pkcs10/PKCS10.java Wed Jan 16 11:25:55 2019 +0800
@@ -1,5 +1,5 @@
/*
- * 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
@@ -32,7 +32,6 @@
import java.security.cert.CertificateException;
import java.security.*;
-import java.security.spec.AlgorithmParameterSpec;
import java.util.Base64;
@@ -237,10 +236,14 @@
*/
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