src/java.base/share/classes/java/security/cert/Certificate.java
changeset 57950 4612a3cfb927
parent 47216 71c04702a3d5
child 58242 94bb65cb37d3
equal deleted inserted replaced
57945:e09c993ac476 57950:4612a3cfb927
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    60  * @since 1.2
    60  * @since 1.2
    61  */
    61  */
    62 
    62 
    63 public abstract class Certificate implements java.io.Serializable {
    63 public abstract class Certificate implements java.io.Serializable {
    64 
    64 
       
    65     @java.io.Serial
    65     private static final long serialVersionUID = -3585440601605666277L;
    66     private static final long serialVersionUID = -3585440601605666277L;
    66 
    67 
    67     // the certificate type
    68     // the certificate type
    68     private final String type;
    69     private final String type;
    69 
    70 
   238      * Alternate Certificate class for serialization.
   239      * Alternate Certificate class for serialization.
   239      * @since 1.3
   240      * @since 1.3
   240      */
   241      */
   241     protected static class CertificateRep implements java.io.Serializable {
   242     protected static class CertificateRep implements java.io.Serializable {
   242 
   243 
       
   244         @java.io.Serial
   243         private static final long serialVersionUID = -8563758940495660020L;
   245         private static final long serialVersionUID = -8563758940495660020L;
   244 
   246 
   245         private String type;
   247         private String type;
   246         private byte[] data;
   248         private byte[] data;
   247 
   249 
   264          * @return the resolved Certificate Object
   266          * @return the resolved Certificate Object
   265          *
   267          *
   266          * @throws java.io.ObjectStreamException if the Certificate
   268          * @throws java.io.ObjectStreamException if the Certificate
   267          *      could not be resolved
   269          *      could not be resolved
   268          */
   270          */
       
   271         @java.io.Serial
   269         protected Object readResolve() throws java.io.ObjectStreamException {
   272         protected Object readResolve() throws java.io.ObjectStreamException {
   270             try {
   273             try {
   271                 CertificateFactory cf = CertificateFactory.getInstance(type);
   274                 CertificateFactory cf = CertificateFactory.getInstance(type);
   272                 return cf.generateCertificate
   275                 return cf.generateCertificate
   273                         (new java.io.ByteArrayInputStream(data));
   276                         (new java.io.ByteArrayInputStream(data));
   288      *
   291      *
   289      * @throws java.io.ObjectStreamException if a new object representing
   292      * @throws java.io.ObjectStreamException if a new object representing
   290      * this Certificate could not be created
   293      * this Certificate could not be created
   291      * @since 1.3
   294      * @since 1.3
   292      */
   295      */
       
   296     @java.io.Serial
   293     protected Object writeReplace() throws java.io.ObjectStreamException {
   297     protected Object writeReplace() throws java.io.ObjectStreamException {
   294         try {
   298         try {
   295             return new CertificateRep(type, getEncoded());
   299             return new CertificateRep(type, getEncoded());
   296         } catch (CertificateException e) {
   300         } catch (CertificateException e) {
   297             throw new java.io.NotSerializableException
   301             throw new java.io.NotSerializableException