code: public byte[] getPrivateKeyBytes() throws KeyException, IOException {
          final String methodName = "getPrivateKeyBytes";
          logger.entry(this, methodName);
  
          final String fileData = getPemFileData();
  
          Matcher m = KEY_PATTERN.matcher(fileData);
          final byte[] keyBytes;
          final String base64KeyDataStr;
          if (m.find()) {
              base64KeyDataStr = m.group(1);
          } else {
              m = ENCRYPTED_KEY_PATTERN.matcher(fileData);
              if (m.find()) {
                  base64KeyDataStr = m.group(1);
              } else {
                  final KeyException exception = new KeyException("Private key not found in PEM file: " + pemFile);
                  logger.throwing(this, methodName, exception);
                  throw exception;
              }
          }
  
          final ByteBuf base64KeyData = Unpooled.copiedBuffer(base64KeyDataStr, Charset.forName("US-ASCII"));
          final ByteBuf keyData = Base64.decode(base64KeyData);
          base64KeyData.release();
          keyBytes = new byte[keyData.readableBytes()];
          keyData.readBytes(keyBytes).release();
  
          logger.exit(this, methodName, keyBytes);
  
          return keyBytes;
      }
docs: Obtains the private key data as a byte array from the PEM file.
  <p>
  Within the PEM file the private key data is base 64 encoded. This method will decode the data for the returned private key
  data.
  <p>
  Note that for an encrypted private key the data will remain encrypted.
  
  @return The private key data.
  @throws KeyException If a private key cannot be found in the PEM file.
  @throws IOException If the PEM file cannot be read for any reason.