mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8229999: Apply java.io.Serial annotations to security types in java.base
Reviewed-by: rriggs, mullan
This commit is contained in:
parent
470d32df73
commit
6d4ef5aaf3
158 changed files with 377 additions and 141 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -43,6 +43,7 @@ import jdk.internal.ref.CleanerFactory;
|
|||
|
||||
final class DESKey implements SecretKey {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 7724971015953279128L;
|
||||
|
||||
private byte[] key;
|
||||
|
@ -136,6 +137,7 @@ final class DESKey implements SecretKey {
|
|||
* readObject is called to restore the state of this key from
|
||||
* a stream.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
|
@ -151,6 +153,7 @@ final class DESKey implements SecretKey {
|
|||
* @throws java.io.ObjectStreamException if a new object representing
|
||||
* this DES key could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object writeReplace() throws java.io.ObjectStreamException {
|
||||
return new KeyRep(KeyRep.Type.SECRET,
|
||||
getAlgorithm(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -43,6 +43,7 @@ import jdk.internal.ref.CleanerFactory;
|
|||
|
||||
final class DESedeKey implements SecretKey {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 2463986565756745178L;
|
||||
|
||||
private byte[] key;
|
||||
|
@ -136,6 +137,7 @@ final class DESedeKey implements SecretKey {
|
|||
* readObject is called to restore the state of this key from
|
||||
* a stream.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
|
@ -151,6 +153,7 @@ final class DESedeKey implements SecretKey {
|
|||
* @throws java.io.ObjectStreamException if a new object representing
|
||||
* this DESede key could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object writeReplace() throws java.io.ObjectStreamException {
|
||||
return new KeyRep(KeyRep.Type.SECRET,
|
||||
getAlgorithm(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -48,6 +48,7 @@ import sun.security.util.*;
|
|||
final class DHPrivateKey implements PrivateKey,
|
||||
javax.crypto.interfaces.DHPrivateKey, Serializable {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 7565477590005668886L;
|
||||
|
||||
// only supported version of PKCS#8 PrivateKeyInfo
|
||||
|
@ -313,6 +314,7 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
|||
* @throws java.io.ObjectStreamException if a new object representing
|
||||
* this DH private key could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object writeReplace() throws java.io.ObjectStreamException {
|
||||
return new KeyRep(KeyRep.Type.PRIVATE,
|
||||
getAlgorithm(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -48,6 +48,7 @@ import sun.security.util.*;
|
|||
final class DHPublicKey implements PublicKey,
|
||||
javax.crypto.interfaces.DHPublicKey, Serializable {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 7647557958927458271L;
|
||||
|
||||
// the public key
|
||||
|
@ -314,6 +315,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
* @throws java.io.ObjectStreamException if a new object representing
|
||||
* this DH public key could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object writeReplace() throws java.io.ObjectStreamException {
|
||||
return new KeyRep(KeyRep.Type.PUBLIC,
|
||||
getAlgorithm(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -44,6 +44,7 @@ import jdk.internal.ref.CleanerFactory;
|
|||
*/
|
||||
final class PBEKey implements SecretKey {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = -2234768909660948176L;
|
||||
|
||||
private byte[] key;
|
||||
|
@ -146,6 +147,7 @@ final class PBEKey implements SecretKey {
|
|||
* readObject is called to restore the state of this key from
|
||||
* a stream.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
|
@ -162,6 +164,7 @@ final class PBEKey implements SecretKey {
|
|||
* @throws java.io.ObjectStreamException if a new object representing
|
||||
* this PBE key could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object writeReplace() throws java.io.ObjectStreamException {
|
||||
return new KeyRep(KeyRep.Type.SECRET,
|
||||
getAlgorithm(),
|
||||
|
|
|
@ -55,6 +55,7 @@ import jdk.internal.ref.CleanerFactory;
|
|||
*/
|
||||
final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = -2234868909660948157L;
|
||||
|
||||
private char[] passwd;
|
||||
|
@ -146,6 +147,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||
byte[] ti = new byte[hlen];
|
||||
// SecretKeySpec cannot be used, since password can be empty here.
|
||||
SecretKey macKey = new SecretKey() {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 7874493593505141603L;
|
||||
@Override
|
||||
public String getAlgorithm() {
|
||||
|
@ -278,6 +280,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||
* @throws ObjectStreamException if a new object representing
|
||||
* this PBE key could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object writeReplace() throws ObjectStreamException {
|
||||
return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(),
|
||||
getFormat(), getEncoded());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
|
@ -33,6 +33,7 @@ import javax.crypto.*;
|
|||
|
||||
final class SealedObjectForKeyProtector extends SealedObject {
|
||||
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = -3650226485480866989L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -79,6 +79,7 @@ import static sun.security.provider.SunEntries.createAliasesWithOid;
|
|||
|
||||
public final class SunJCE extends Provider {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 6812507587804302833L;
|
||||
|
||||
private static final String info = "SunJCE Provider " +
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
|
@ -154,6 +154,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final class TlsMasterSecretKey implements TlsMasterSecret {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 1019571680375368880L;
|
||||
|
||||
private byte[] key;
|
||||
|
|
|
@ -54,6 +54,7 @@ import java.util.Vector;
|
|||
@SuppressWarnings("removal")
|
||||
@Deprecated(since="9", forRemoval=true)
|
||||
public class X509V1CertImpl extends X509Certificate implements Serializable {
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = -2048442350420423405L;
|
||||
private java.security.cert.X509Certificate wrappedCert;
|
||||
|
||||
|
@ -307,6 +308,7 @@ public class X509V1CertImpl extends X509Certificate implements Serializable {
|
|||
return wrappedCert.getSigAlgParams();
|
||||
}
|
||||
|
||||
@java.io.Serial
|
||||
private synchronized void writeObject(ObjectOutputStream stream)
|
||||
throws IOException {
|
||||
try {
|
||||
|
@ -316,6 +318,7 @@ public class X509V1CertImpl extends X509Certificate implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@java.io.Serial
|
||||
private synchronized void readObject(ObjectInputStream stream)
|
||||
throws IOException {
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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
|
||||
|
@ -31,6 +31,7 @@ import java.security.GeneralSecurityException;
|
|||
* An NTLM-related Exception
|
||||
*/
|
||||
public final class NTLMException extends GeneralSecurityException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -3298539507906689430L;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue