mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8246397: Use KnownOIDs for known OIDs
Reviewed-by: xuelei
This commit is contained in:
parent
2bfc64ad1f
commit
bcbe46b0b3
10 changed files with 67 additions and 74 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
|
||||
|
@ -45,6 +45,7 @@ import java.nio.ReadOnlyBufferException;
|
|||
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.jca.*;
|
||||
import sun.security.util.KnownOIDs;
|
||||
|
||||
/**
|
||||
* This class provides the functionality of a cryptographic cipher for
|
||||
|
@ -238,9 +239,6 @@ public class Cipher {
|
|||
// cipher has been initialized.
|
||||
private int opmode = 0;
|
||||
|
||||
// The OID for the KeyUsage extension in an X.509 v3 certificate
|
||||
private static final String KEY_USAGE_EXTENSION_OID = "2.5.29.15";
|
||||
|
||||
// next SPI to try in provider selection
|
||||
// null once provider is selected
|
||||
private CipherSpi firstSpi;
|
||||
|
@ -1742,7 +1740,7 @@ public class Cipher {
|
|||
Set<String> critSet = cert.getCriticalExtensionOIDs();
|
||||
|
||||
if (critSet != null && !critSet.isEmpty()
|
||||
&& critSet.contains(KEY_USAGE_EXTENSION_OID)) {
|
||||
&& critSet.contains(KnownOIDs.KeyUsage.value())) {
|
||||
boolean[] keyUsageInfo = cert.getKeyUsage();
|
||||
// keyUsageInfo[2] is for keyEncipherment;
|
||||
// keyUsageInfo[3] is for dataEncipherment.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue