Key objects and key specifications (KeySpecs) are two different representations of key data.
Ciphers use Key objects to initialize their encryption algorithms, but keys may need to be converted into a more portable format for transmission or storage.
A transparent representation of keys means that you can access each key material value individually, through one of the get methods defined in the corresponding specification class.
For example, DSAPrivateKeySpec defines getX, getP, getQ, and getG methods, to access the private key x, and the DSA algorithm parameters used to calculate the key(the prime p, the sub-prime q, and the base g).
If the key is stored on a hardware device, its specification may contain information that helps identify the key on the device.This representation is contrasted with an opaque representation, as defined by the Key interface, in which you have no direct access to the key material fields. In other words, an "opaque" representation gives you limited access to the key-just the three methods defined by the Key interface: getAlgorithm, getFormat, and getEncoded.
A key may be specified in an algorithm-specific way, or in an algorithm-independent encoding format (such as ASN.1).
For example, a DSA private key may be specified by its components x, p, q, and g (eg: DSAPrivateKeySpec), or it may be specified using its DER encoding (eg: PKCS8EncodedKeySpec).
The KeyFactory and SecretKeyFactory classes can be used to convert between opaque and transparent key representations that is, between Keys and KeySpecs.
Reference and more details available at:
https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html#KeySpecs