< prev index next >

src/java.base/share/classes/java/security/spec/ECFieldFp.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
   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  28 import java.util.Arrays;
  29 
  30 /**
  31  * This immutable class defines an elliptic curve (EC) prime
  32  * finite field.
  33  *
  34  * @see ECField
  35  *
  36  * @author Valerie Peng
  37  *
  38  * @since 1.5
  39  */
  40 public class ECFieldFp implements ECField {
  41 
  42     private BigInteger p;
  43 
  44     /**
  45      * Creates an elliptic curve prime finite field
  46      * with the specified prime {@code p}.
  47      * @param p the prime.
  48      * @exception NullPointerException if {@code p} is null.
  49      * @exception IllegalArgumentException if {@code p}
  50      * is not positive.
  51      */
  52     public ECFieldFp(BigInteger p) {
  53         if (p.signum() != 1) {
  54             throw new IllegalArgumentException("p is not positive");
  55         }
  56         this.p = p;
  57     }
  58 
  59     /**
  60      * Returns the field size in bits which is size of prime p
  61      * for this prime finite field.
  62      * @return the field size in bits.
  63      */
  64     public int getFieldSize() {
  65         return p.bitLength();
  66     };
  67 
  68     /**
  69      * Returns the prime {@code p} of this prime finite field.


   1 /*
   2  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  28 import java.util.Arrays;
  29 
  30 /**
  31  * This immutable class defines an elliptic curve (EC) prime
  32  * finite field.
  33  *
  34  * @see ECField
  35  *
  36  * @author Valerie Peng
  37  *
  38  * @since 1.5
  39  */
  40 public class ECFieldFp implements ECField {
  41 
  42     private BigInteger p;
  43 
  44     /**
  45      * Creates an elliptic curve prime finite field
  46      * with the specified prime {@code p}.
  47      * @param p the prime.
  48      * @throws    NullPointerException if {@code p} is null.
  49      * @throws    IllegalArgumentException if {@code p}
  50      * is not positive.
  51      */
  52     public ECFieldFp(BigInteger p) {
  53         if (p.signum() != 1) {
  54             throw new IllegalArgumentException("p is not positive");
  55         }
  56         this.p = p;
  57     }
  58 
  59     /**
  60      * Returns the field size in bits which is size of prime p
  61      * for this prime finite field.
  62      * @return the field size in bits.
  63      */
  64     public int getFieldSize() {
  65         return p.bitLength();
  66     };
  67 
  68     /**
  69      * Returns the prime {@code p} of this prime finite field.


< prev index next >