mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8269151: Better construction of EncryptedPrivateKeyInfo
Reviewed-by: jnimeh, mschoene, rhalade
This commit is contained in:
parent
c372990f5f
commit
6b6f829b46
1 changed files with 8 additions and 5 deletions
|
@ -77,15 +77,18 @@ public class EncryptedPrivateKeyInfo {
|
||||||
* @exception NullPointerException if the <code>encoded</code> is null.
|
* @exception NullPointerException if the <code>encoded</code> is null.
|
||||||
* @exception IOException if error occurs when parsing the ASN.1 encoding.
|
* @exception IOException if error occurs when parsing the ASN.1 encoding.
|
||||||
*/
|
*/
|
||||||
public EncryptedPrivateKeyInfo(byte[] encoded)
|
public EncryptedPrivateKeyInfo(byte[] encoded) throws IOException {
|
||||||
throws IOException {
|
|
||||||
if (encoded == null) {
|
if (encoded == null) {
|
||||||
throw new NullPointerException("the encoded parameter " +
|
throw new NullPointerException("the encoded parameter " +
|
||||||
"must be non-null");
|
"must be non-null");
|
||||||
}
|
}
|
||||||
this.encoded = encoded.clone();
|
|
||||||
DerValue val = new DerValue(this.encoded);
|
|
||||||
|
|
||||||
|
DerValue val = new DerValue(encoded);
|
||||||
|
if (val.tag != DerValue.tag_Sequence) {
|
||||||
|
throw new IOException("DER header error: no SEQ tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.encoded = encoded.clone();
|
||||||
DerValue[] seq = new DerValue[2];
|
DerValue[] seq = new DerValue[2];
|
||||||
|
|
||||||
seq[0] = val.data.getDerValue();
|
seq[0] = val.data.getDerValue();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue