< prev index next >

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

Print this page




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


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