mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8239264: Clearup the legacy ObjectIdentifier constructor from int array
Reviewed-by: jnimeh
This commit is contained in:
parent
8aff5bda80
commit
4e430ffbb6
26 changed files with 412 additions and 692 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2020, 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
|
||||
|
@ -72,8 +72,6 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
|||
// the private-value length (optional)
|
||||
private int l;
|
||||
|
||||
private int DH_data[] = { 1, 2, 840, 113549, 1, 3, 1 };
|
||||
|
||||
/**
|
||||
* Make a DH private key out of a private value <code>x</code>, a prime
|
||||
* modulus <code>p</code>, and a base generator <code>g</code>.
|
||||
|
@ -220,7 +218,7 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
|||
DerOutputStream algid = new DerOutputStream();
|
||||
|
||||
// store OID
|
||||
algid.putOID(new ObjectIdentifier(DH_data));
|
||||
algid.putOID(DHPublicKey.DH_OID);
|
||||
// encode parameters
|
||||
DerOutputStream params = new DerOutputStream();
|
||||
params.putInteger(this.p);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2020, 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
|
||||
|
@ -69,7 +69,9 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
// the private-value length (optional)
|
||||
private int l;
|
||||
|
||||
private int DH_data[] = { 1, 2, 840, 113549, 1, 3, 1 };
|
||||
// Note: this OID is used by DHPrivateKey as well.
|
||||
static ObjectIdentifier DH_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.1.3.1");
|
||||
|
||||
/**
|
||||
* Make a DH public key out of a public value <code>y</code>, a prime
|
||||
|
@ -203,7 +205,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
DerOutputStream algid = new DerOutputStream();
|
||||
|
||||
// store oid in algid
|
||||
algid.putOID(new ObjectIdentifier(DH_data));
|
||||
algid.putOID(DH_OID);
|
||||
|
||||
// encode parameters
|
||||
DerOutputStream params = new DerOutputStream();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, 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
|
||||
|
@ -55,24 +55,10 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
|
|||
private String mdName;
|
||||
private MGF1ParameterSpec mgfSpec;
|
||||
private byte[] p;
|
||||
private static ObjectIdentifier OID_MGF1;
|
||||
private static ObjectIdentifier OID_PSpecified;
|
||||
|
||||
static {
|
||||
try {
|
||||
OID_MGF1 = new ObjectIdentifier(new int[] {1,2,840,113549,1,1,8});
|
||||
} catch (IOException ioe) {
|
||||
// should not happen
|
||||
OID_MGF1 = null;
|
||||
}
|
||||
try {
|
||||
OID_PSpecified =
|
||||
new ObjectIdentifier(new int[] {1,2,840,113549,1,1,9});
|
||||
} catch (IOException ioe) {
|
||||
// should not happen
|
||||
OID_PSpecified = null;
|
||||
}
|
||||
}
|
||||
private static ObjectIdentifier OID_MGF1 =
|
||||
ObjectIdentifier.of("1.2.840.113549.1.1.8");
|
||||
private static ObjectIdentifier OID_PSpecified =
|
||||
ObjectIdentifier.of("1.2.840.113549.1.1.9");
|
||||
|
||||
public OAEPParameters() {
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, 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
|
||||
|
@ -90,57 +90,28 @@ import sun.security.util.*;
|
|||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
abstract class PBES2Parameters extends AlgorithmParametersSpi {
|
||||
|
||||
private static final int pkcs5PBKDF2[] =
|
||||
{1, 2, 840, 113549, 1, 5, 12};
|
||||
private static final int pkcs5PBES2[] =
|
||||
{1, 2, 840, 113549, 1, 5, 13};
|
||||
private static final int hmacWithSHA1[] =
|
||||
{1, 2, 840, 113549, 2, 7};
|
||||
private static final int hmacWithSHA224[] =
|
||||
{1, 2, 840, 113549, 2, 8};
|
||||
private static final int hmacWithSHA256[] =
|
||||
{1, 2, 840, 113549, 2, 9};
|
||||
private static final int hmacWithSHA384[] =
|
||||
{1, 2, 840, 113549, 2, 10};
|
||||
private static final int hmacWithSHA512[] =
|
||||
{1, 2, 840, 113549, 2, 11};
|
||||
private static final int aes128CBC[] =
|
||||
{2, 16, 840, 1, 101, 3, 4, 1, 2};
|
||||
private static final int aes192CBC[] =
|
||||
{2, 16, 840, 1, 101, 3, 4, 1, 22};
|
||||
private static final int aes256CBC[] =
|
||||
{2, 16, 840, 1, 101, 3, 4, 1, 42};
|
||||
|
||||
private static ObjectIdentifier pkcs5PBKDF2_OID;
|
||||
private static ObjectIdentifier pkcs5PBES2_OID;
|
||||
private static ObjectIdentifier hmacWithSHA1_OID;
|
||||
private static ObjectIdentifier hmacWithSHA224_OID;
|
||||
private static ObjectIdentifier hmacWithSHA256_OID;
|
||||
private static ObjectIdentifier hmacWithSHA384_OID;
|
||||
private static ObjectIdentifier hmacWithSHA512_OID;
|
||||
private static ObjectIdentifier aes128CBC_OID;
|
||||
private static ObjectIdentifier aes192CBC_OID;
|
||||
private static ObjectIdentifier aes256CBC_OID;
|
||||
|
||||
static {
|
||||
try {
|
||||
pkcs5PBKDF2_OID = new ObjectIdentifier(pkcs5PBKDF2);
|
||||
pkcs5PBES2_OID = new ObjectIdentifier(pkcs5PBES2);
|
||||
hmacWithSHA1_OID = new ObjectIdentifier(hmacWithSHA1);
|
||||
hmacWithSHA224_OID = new ObjectIdentifier(hmacWithSHA224);
|
||||
hmacWithSHA256_OID = new ObjectIdentifier(hmacWithSHA256);
|
||||
hmacWithSHA384_OID = new ObjectIdentifier(hmacWithSHA384);
|
||||
hmacWithSHA512_OID = new ObjectIdentifier(hmacWithSHA512);
|
||||
aes128CBC_OID = new ObjectIdentifier(aes128CBC);
|
||||
aes192CBC_OID = new ObjectIdentifier(aes192CBC);
|
||||
aes256CBC_OID = new ObjectIdentifier(aes256CBC);
|
||||
} catch (IOException ioe) {
|
||||
// should not happen
|
||||
}
|
||||
}
|
||||
private static ObjectIdentifier pkcs5PBKDF2_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.1.5.12");
|
||||
private static ObjectIdentifier pkcs5PBES2_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.1.5.13");
|
||||
private static ObjectIdentifier hmacWithSHA1_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.2.7");
|
||||
private static ObjectIdentifier hmacWithSHA224_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.2.8");
|
||||
private static ObjectIdentifier hmacWithSHA256_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.2.9");
|
||||
private static ObjectIdentifier hmacWithSHA384_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.2.10");
|
||||
private static ObjectIdentifier hmacWithSHA512_OID =
|
||||
ObjectIdentifier.of("1.2.840.113549.2.11");
|
||||
private static ObjectIdentifier aes128CBC_OID =
|
||||
ObjectIdentifier.of("2.16.840.1.101.3.4.1.2");
|
||||
private static ObjectIdentifier aes192CBC_OID =
|
||||
ObjectIdentifier.of("2.16.840.1.101.3.4.1.22");
|
||||
private static ObjectIdentifier aes256CBC_OID =
|
||||
ObjectIdentifier.of("2.16.840.1.101.3.4.1.42");
|
||||
|
||||
// the PBES2 algorithm name
|
||||
private String pbes2AlgorithmName = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue