< prev index next >

src/java.base/share/classes/java/security/cert/Certificate.java

Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea


 131         int h = hash;
 132         if (h == -1) {
 133             try {
 134                 h = Arrays.hashCode(X509CertImpl.getEncodedInternal(this));
 135             } catch (CertificateException e) {
 136                 h = 0;
 137             }
 138             hash = h;
 139         }
 140         return h;
 141     }
 142 
 143     /**
 144      * Returns the encoded form of this certificate. It is
 145      * assumed that each certificate type would have only a single
 146      * form of encoding; for example, X.509 certificates would
 147      * be encoded as ASN.1 DER.
 148      *
 149      * @return the encoded form of this certificate
 150      *
 151      * @exception CertificateEncodingException if an encoding error occurs.
 152      */
 153     public abstract byte[] getEncoded()
 154         throws CertificateEncodingException;
 155 
 156     /**
 157      * Verifies that this certificate was signed using the
 158      * private key that corresponds to the specified public key.
 159      *
 160      * @param key the PublicKey used to carry out the verification.
 161      *
 162      * @exception NoSuchAlgorithmException on unsupported signature
 163      * algorithms.
 164      * @exception InvalidKeyException on incorrect key.
 165      * @exception NoSuchProviderException if there's no default provider.
 166      * @exception SignatureException on signature errors.
 167      * @exception CertificateException on encoding errors.
 168      */
 169     public abstract void verify(PublicKey key)
 170         throws CertificateException, NoSuchAlgorithmException,
 171         InvalidKeyException, NoSuchProviderException,
 172         SignatureException;
 173 
 174     /**
 175      * Verifies that this certificate was signed using the
 176      * private key that corresponds to the specified public key.
 177      * This method uses the signature verification engine
 178      * supplied by the specified provider.
 179      *
 180      * @param key the PublicKey used to carry out the verification.
 181      * @param sigProvider the name of the signature provider.
 182      *
 183      * @exception NoSuchAlgorithmException on unsupported signature
 184      * algorithms.
 185      * @exception InvalidKeyException on incorrect key.
 186      * @exception NoSuchProviderException on incorrect provider.
 187      * @exception SignatureException on signature errors.
 188      * @exception CertificateException on encoding errors.
 189      */
 190     public abstract void verify(PublicKey key, String sigProvider)
 191         throws CertificateException, NoSuchAlgorithmException,
 192         InvalidKeyException, NoSuchProviderException,
 193         SignatureException;
 194 
 195     /**
 196      * Verifies that this certificate was signed using the
 197      * private key that corresponds to the specified public key.
 198      * This method uses the signature verification engine
 199      * supplied by the specified provider. Note that the specified
 200      * Provider object does not have to be registered in the provider list.
 201      *
 202      * <p> This method was added to version 1.8 of the Java Platform
 203      * Standard Edition. In order to maintain backwards compatibility with
 204      * existing service providers, this method cannot be {@code abstract}
 205      * and by default throws an {@code UnsupportedOperationException}.
 206      *
 207      * @param key the PublicKey used to carry out the verification.
 208      * @param sigProvider the signature provider.
 209      *
 210      * @exception NoSuchAlgorithmException on unsupported signature
 211      * algorithms.
 212      * @exception InvalidKeyException on incorrect key.
 213      * @exception SignatureException on signature errors.
 214      * @exception CertificateException on encoding errors.
 215      * @exception UnsupportedOperationException if the method is not supported
 216      * @since 1.8
 217      */
 218     public void verify(PublicKey key, Provider sigProvider)
 219         throws CertificateException, NoSuchAlgorithmException,
 220         InvalidKeyException, SignatureException {
 221         throw new UnsupportedOperationException();
 222     }
 223 
 224     /**
 225      * Returns a string representation of this certificate.
 226      *
 227      * @return a string representation of this certificate.
 228      */
 229     public abstract String toString();
 230 
 231     /**
 232      * Gets the public key from this certificate.
 233      *
 234      * @return the public key.
 235      */




 131         int h = hash;
 132         if (h == -1) {
 133             try {
 134                 h = Arrays.hashCode(X509CertImpl.getEncodedInternal(this));
 135             } catch (CertificateException e) {
 136                 h = 0;
 137             }
 138             hash = h;
 139         }
 140         return h;
 141     }
 142 
 143     /**
 144      * Returns the encoded form of this certificate. It is
 145      * assumed that each certificate type would have only a single
 146      * form of encoding; for example, X.509 certificates would
 147      * be encoded as ASN.1 DER.
 148      *
 149      * @return the encoded form of this certificate
 150      *
 151      * @throws    CertificateEncodingException if an encoding error occurs.
 152      */
 153     public abstract byte[] getEncoded()
 154         throws CertificateEncodingException;
 155 
 156     /**
 157      * Verifies that this certificate was signed using the
 158      * private key that corresponds to the specified public key.
 159      *
 160      * @param key the PublicKey used to carry out the verification.
 161      *
 162      * @throws    NoSuchAlgorithmException on unsupported signature
 163      * algorithms.
 164      * @throws    InvalidKeyException on incorrect key.
 165      * @throws    NoSuchProviderException if there's no default provider.
 166      * @throws    SignatureException on signature errors.
 167      * @throws    CertificateException on encoding errors.
 168      */
 169     public abstract void verify(PublicKey key)
 170         throws CertificateException, NoSuchAlgorithmException,
 171         InvalidKeyException, NoSuchProviderException,
 172         SignatureException;
 173 
 174     /**
 175      * Verifies that this certificate was signed using the
 176      * private key that corresponds to the specified public key.
 177      * This method uses the signature verification engine
 178      * supplied by the specified provider.
 179      *
 180      * @param key the PublicKey used to carry out the verification.
 181      * @param sigProvider the name of the signature provider.
 182      *
 183      * @throws    NoSuchAlgorithmException on unsupported signature
 184      * algorithms.
 185      * @throws    InvalidKeyException on incorrect key.
 186      * @throws    NoSuchProviderException on incorrect provider.
 187      * @throws    SignatureException on signature errors.
 188      * @throws    CertificateException on encoding errors.
 189      */
 190     public abstract void verify(PublicKey key, String sigProvider)
 191         throws CertificateException, NoSuchAlgorithmException,
 192         InvalidKeyException, NoSuchProviderException,
 193         SignatureException;
 194 
 195     /**
 196      * Verifies that this certificate was signed using the
 197      * private key that corresponds to the specified public key.
 198      * This method uses the signature verification engine
 199      * supplied by the specified provider. Note that the specified
 200      * Provider object does not have to be registered in the provider list.
 201      *
 202      * <p> This method was added to version 1.8 of the Java Platform
 203      * Standard Edition. In order to maintain backwards compatibility with
 204      * existing service providers, this method cannot be {@code abstract}
 205      * and by default throws an {@code UnsupportedOperationException}.
 206      *
 207      * @param key the PublicKey used to carry out the verification.
 208      * @param sigProvider the signature provider.
 209      *
 210      * @throws    NoSuchAlgorithmException on unsupported signature
 211      * algorithms.
 212      * @throws    InvalidKeyException on incorrect key.
 213      * @throws    SignatureException on signature errors.
 214      * @throws    CertificateException on encoding errors.
 215      * @throws    UnsupportedOperationException if the method is not supported
 216      * @since 1.8
 217      */
 218     public void verify(PublicKey key, Provider sigProvider)
 219         throws CertificateException, NoSuchAlgorithmException,
 220         InvalidKeyException, SignatureException {
 221         throw new UnsupportedOperationException();
 222     }
 223 
 224     /**
 225      * Returns a string representation of this certificate.
 226      *
 227      * @return a string representation of this certificate.
 228      */
 229     public abstract String toString();
 230 
 231     /**
 232      * Gets the public key from this certificate.
 233      *
 234      * @return the public key.
 235      */


< prev index next >