< prev index next >

jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java

Print this page




  65     }
  66 
  67     /**
  68      * Creates a new {@code X509EncodedKeySpec} with the given encoded key.
  69      * This constructor is useful when subsequent callers of the
  70      * {@code X509EncodedKeySpec} object might not know the algorithm
  71      * of the key.
  72      *
  73      * @param encodedKey the key, which is assumed to be
  74      * encoded according to the X.509 standard. The contents of the
  75      * array are copied to protect against subsequent modification.
  76      * @param algorithm the algorithm name of the encoded public key
  77      * See the KeyFactory section in the <a href=
  78      * "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyFactory">
  79      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
  80      * for information about standard algorithm names.
  81      * @throws NullPointerException if {@code encodedKey}
  82      * or {@code algorithm} is null.
  83      * @throws IllegalArgumentException if {@code algorithm} is
  84      * the empty string {@code ""}
  85      * @since 1.9
  86      */
  87     public X509EncodedKeySpec(byte[] encodedKey, String algorithm) {
  88         super(encodedKey, algorithm);
  89     }
  90 
  91     /**
  92      * Returns the key bytes, encoded according to the X.509 standard.
  93      *
  94      * @return the X.509 encoding of the key. Returns a new array
  95      * each time this method is called.
  96      */
  97     public byte[] getEncoded() {
  98         return super.getEncoded();
  99     }
 100 
 101     /**
 102      * Returns the name of the encoding format associated with this
 103      * key specification.
 104      *
 105      * @return the string {@code "X.509"}.


  65     }
  66 
  67     /**
  68      * Creates a new {@code X509EncodedKeySpec} with the given encoded key.
  69      * This constructor is useful when subsequent callers of the
  70      * {@code X509EncodedKeySpec} object might not know the algorithm
  71      * of the key.
  72      *
  73      * @param encodedKey the key, which is assumed to be
  74      * encoded according to the X.509 standard. The contents of the
  75      * array are copied to protect against subsequent modification.
  76      * @param algorithm the algorithm name of the encoded public key
  77      * See the KeyFactory section in the <a href=
  78      * "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyFactory">
  79      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
  80      * for information about standard algorithm names.
  81      * @throws NullPointerException if {@code encodedKey}
  82      * or {@code algorithm} is null.
  83      * @throws IllegalArgumentException if {@code algorithm} is
  84      * the empty string {@code ""}
  85      * @since 9
  86      */
  87     public X509EncodedKeySpec(byte[] encodedKey, String algorithm) {
  88         super(encodedKey, algorithm);
  89     }
  90 
  91     /**
  92      * Returns the key bytes, encoded according to the X.509 standard.
  93      *
  94      * @return the X.509 encoding of the key. Returns a new array
  95      * each time this method is called.
  96      */
  97     public byte[] getEncoded() {
  98         return super.getEncoded();
  99     }
 100 
 101     /**
 102      * Returns the name of the encoding format associated with this
 103      * key specification.
 104      *
 105      * @return the string {@code "X.509"}.
< prev index next >