code: @CheckForNull
      private static PrivateKeyInfo getPrivateKeyInfoOrNull(Object pemObject) throws NoSuchAlgorithmException {
          PrivateKeyInfo privateKeyInfo = null;
          if (pemObject instanceof PEMKeyPair) {
              PEMKeyPair pemKeyPair = (PEMKeyPair) pemObject;
              privateKeyInfo = pemKeyPair.getPrivateKeyInfo();
          } else if (pemObject instanceof PrivateKeyInfo) {
              privateKeyInfo = (PrivateKeyInfo) pemObject;
          } else if (pemObject instanceof ASN1ObjectIdentifier) {
              // no idea how it can be used
              final ASN1ObjectIdentifier asn1ObjectIdentifier = (ASN1ObjectIdentifier) pemObject;
              LOG.trace("Ignoring asn1ObjectIdentifier {}", asn1ObjectIdentifier);
          } else {
              LOG.warn("Unknown object '{}' from PEMParser", pemObject);
          }
          return privateKeyInfo;
      }
docs: Find a PrivateKeyInfo in the PEM object details. Returns null if the PEM object type is unknown.