This interface represents a secret key used for symmetric cryptographic algorithms that depend on both the sender and receiver knowing the same secret. SecretKey extends the java.security.Key interface, but does not add any new methods . The interface exists in order to keep secret keys distinct from the public and private keys used in public-key, or asymmetric, cryptography. See also java.security.PublicKey and java.security.PrivateKey . A secret key is nothing more than arrays of bytes and does not require a specialized encoding format. Therefore, an implementation of this interface should return the format name "RAW" from getFormat( ) and should return the bytes of the key from getEncoded( ) . (These two methods are defined by the java.security.Key interface that SecretKey extends.) Figure 17-10. javax.crypto.SecretKeypublic interface SecretKey extends java.security.Key { // Public Constants 5.0 public static final long serialVersionUID ; =-4795878709595146952 } Implementationsjavax.crypto.interfaces.PBEKey , javax.crypto.spec.SecretKeySpec , javax.security.auth.kerberos.KerberosKey Passed Tojava.security.KeyStore.SecretKeyEntry.SecretKeyEntry( ) , SecretKeyFactory.{getKeySpec( ) , translateKey( )} , SecretKeyFactorySpi.{engineGetKeySpec( ) , engineTranslateKey( )} Returned Byjava.security.KeyStore.SecretKeyEntry.getSecretKey( ) , KeyAgreement.generateSecret( ) , KeyAgreementSpi.engineGenerateSecret( ) , KeyGenerator.generateKey( ) , KeyGeneratorSpi.engineGenerateKey( ) , SecretKeyFactory.{generateSecret( ) , translateKey( )} , SecretKeyFactorySpi.{engineGenerateSecret( ) , engineTranslateKey( )} , javax.security.auth.kerberos.KerberosTicket.getSessionKey( ) |